Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#Here I am zipping all the files in a specific directory $dir = $main_path_only; # This variable will have all the path to dire +ctories that has *.log file(s). $zip = Archive::Zip->new(); $zipped; #Chopped log files and Zipped files will be created in the directories + below: my $zip_file = $arch_path."/".$dir_archive."/"."$month$date-$year"."-n +ewlog.zip"; $zipped = $zip->addDirectory( $dir); $zipped->desiredCompressionMethod( COMPRESSION_DEFLATED ); find(\&zip_file, $dir); die 'write error' unless $zip->writeToFileNamed( $zip_file ) == AZ_OK; #End archiving ######ZIP SUB################################ sub zip_file { #$zipped = $zip->addFile( $File::Find::name ); if ($File::Find::name =~ m/\.log$/i){ $zipped = $zip->addFile( $File::Find::name ); } } #####END ZIP SUB###########################
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading at File Level in Directories
by Joost (Canon) on Jun 07, 2006 at 15:16 UTC | |
by Anonymous Monk on Jun 07, 2006 at 15:49 UTC | |
by Anonymous Monk on Jun 07, 2006 at 15:50 UTC | |
|
Re: Reading at File Level in Directories
by sgifford (Prior) on Jun 07, 2006 at 15:46 UTC |