use warnings;
use Archive::Zip;
$zip = Archive::Zip->new();
$zip->addTree( 'd:/Purandaran/PerlFiles', '');
$zip->writeToFileNamed("PerlFiles.zip");
__END__
#!perl -w
use strict;
use File::Find;
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
my $dir = 'd:/Purandaran/PerlFiles';
my $zip = Archive::Zip->new();
my $zipped;
$zipped = $zip->addDirectory( $dir );
$zipped->desiredCompressionMethod( COMPRESSION_DEFLATED );
find(\&zip_file, $dir);
die 'write error' unless $zip->writeToFileNamed( 'PerlFiles.zip' ) == AZ_OK;
sub zip_file {
$zipped = $zip->addFile( $File::Find::name );
}
No comments:
Post a Comment