ising archive::zip

June 19, 2009 at 02:44:06
Specs: Windows XP
I am new in perl & i am trying to zip a file in a directory d:\shabdita\file1.txt using the module Archive::zip this is my script what am i doing wrong
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
my $dir='d:/shabdita/abc';
my $zip=Archive::Zip->new();
my $zipped;

$zipped = $zip->addDirectory( $dir );
$zipped->desiredCompressionMethod( COMPRESSION_DEFLATED );
$zipped = $zip->addFile('file1.txt');
die 'write error' unless $zip->writeToFileNamed( 'show.zip' ) == AZ_OK;



See More: ising archive::zip

Report •


#1
June 19, 2009 at 05:03:42
check the perldoc Archive::Zip for examples on how to do it.

GNU win32 packages | Gawk


Report •

#2
June 19, 2009 at 06:05:05
my $zipName = "d:/shabdita/file1.zip";
chdir ('d:/shabdita');
my $memberName = "file1.txt";
my $zip = Archive::Zip->new();
$zip->addFile( $memberName );
$status = $zip->writeToFileNamed($zipName);
if ( $status == 0 ) {
print "Delete source file $memberName \n";
unlink $memberName;
} else {
print "Error. Do not delete source file $memberName \n";
}

Report •

Related Solutions


Ask Question