in reply to Re^2: Creating a .zip file using perl
in thread Creating a .zip file using perl
The following code will use Archive::Zip to create a zip with all the .lib files from a specified directory.
This was pulled pretty much directly from the examples in the documentation
use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); use File::Spec; use strict; use warnings; my $zipfile = shift or die "What's the zipfile?"; my $dir = shift or die "Where's the dir?"; my $zip = Archive::Zip->new(); opendir my $dh, $dir or die $!; while (readdir $dh) { next if !/\.lib$/; $zip->addFile(File::Spec->catfile($dir, $_), $_); } closedir $dh; # Save the Zip file unless ( $zip->writeToFileNamed($zipfile) == AZ_OK ) { die 'write error'; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Creating a .zip file using perl
by Anonymous Monk on May 05, 2011 at 07:12 UTC | |
by wind (Priest) on May 05, 2011 at 07:20 UTC | |
by Utilitarian (Vicar) on May 05, 2011 at 08:18 UTC | |
by Anonymous Monk on May 05, 2011 at 08:47 UTC | |
by Utilitarian (Vicar) on May 05, 2011 at 08:56 UTC | |
| |
by Anonymous Monk on May 05, 2011 at 07:29 UTC | |
by Anonymous Monk on May 05, 2011 at 07:33 UTC |