Computing.Net > Forums > Programming > ising archive::zip

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

ising archive::zip

Reply to Message Icon

Name: shabbydoo
Date: June 19, 2009 at 02:44:06 Pacific
OS: Windows XP
Subcategory: General
Comment:

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;




Sponsored Link
Ads by Google

Response Number 1
Name: ghostdog
Date: June 19, 2009 at 05:03:42 Pacific
Reply:

check the perldoc Archive::Zip for examples on how to do it.

GNU win32 packages | Gawk


0

Response Number 2
Name: David Perry
Date: June 19, 2009 at 06:05:05 Pacific
Reply:

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";
}


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


SED help with batch Header and trailer for cs...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: ising archive::zip

Perl Archive::zip www.computing.net/answers/programming/perl-archivezip/13795.html

Count number of files in zip archive www.computing.net/answers/programming/count-number-of-files-in-zip-archive/20254.html

help with unziiping file archives!! www.computing.net/answers/programming/help-with-unziiping-file-archives/8120.html