[LUNI] TAR
Christopher Young
cyoung at ckynet.net
Wed Nov 7 13:36:10 CST 2001
Perhaps something like the below (I haven't used the system call, just
looked it up, the rest of the perl should work).
---cut here---
#!/usr/bin/perl
my $name = undef;
opendir(TARDIR, "/path/to/tar/dir");
while (defined($name = readdir(TARDIR))) {
if (($name ne "..") && ($name ne ".")) {
@args = ("tar","xf",$name);
system(@args) == 0 or die "untar failed";
}
}
closedir(TARDIR);
--end--
or perhaps a simple shell script in bash?
#!/bin/bash
for file in `ls /var/tardir`; do tar xf $file; done;
/cky
On Wed, Nov 07, 2001 at 12:34:52PM -0500, Jeff Norton wrote:
> I need to write a script that will untar several files. I can't hardcode
> the file names in the script because they will change. Any ideas?
>
> Jeff Norton
>
> ______________________________________________________________________
> Linux Users Of Northern Illinois - Technical Discussion
> luni at luni.org
> http://luni.org/mailman/listinfo/luni
More information about the luni
mailing list