#!microperl #to substitute for a readdir or glob #I needed to ls then grep my @files = `ls`; @files = grep($_ =~ /.tar.gz$/,@files); foreach(@files){print "\ngunzipping->$_\n"; system("gunzip $_")} my @files = `ls`; @files = grep($_ =~ /.tar$/,@files); (@bases) = map{$_ =~ m/^(.*)-\d+.tar$/ }@files; print "@bases\n"; my %hash; $hash{$_}++ foreach (@bases); print "$_: $hash{$_}\n " foreach (sort {$hash{$a} <=> $hash{$b}} keys +%hash); foreach $basename (keys %hash){ #initialize first file if (-e "$basename-1.tar"){ $old= "$basename-1.tar"; $new= "$basename.tar"; rename $old,$new or warn $!; } #the restore-rotate.pl script just swaps files like they were tapes system ('tar','-x','-M',"-F ./restore-rotate.pl $basename","-f$basenam +e.tar"); unlink "$basename.tar"; #cleanup print "----------------------------------\n"; } system("mkdir proc"); system("mkdir tmp"); system("mkdir home"); exit;