#! /usr/bin/perl -w
use strict;
#Holds file names
my @untar_files =();
#Use to store list of decompressed/untar'd Directories for deleting with rmalldir
open DIRS, "> ./dirlist" or die "Can't open dirlist:$!";
#Decompresses and untars all the tar.gz files in the dir
foreach ( glob "*.tar.gz" ) {
system "gzip -cd $_ | tar xvf -";
push @untar_files, "$_\n"; #Put name in array for reporting status
$_=~ s/(.*).tar.gz/$1/; #Remove .tar.gz from file name
print DIRS "$_\n"; #Print dir names to a file
}
#Reports filenames that were decompressed
system "clear";
print "Untared and Decompressed:\n @untar_files\n";
|