Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Creating a .zip file using perl

by changma_ha (Sexton)
on May 05, 2011 at 09:31 UTC ( [id://903102]=note: print w/replies, xml ) Need Help??


in reply to Re: Creating a .zip file using perl
in thread Creating a .zip file using perl

you can see the following example:

use strict; use warnings; use Archive::Zip; #use Archive::Tar; print "Starting...\n"; # Archive::Zip Synopsis (relative path to directory) my $zip1 = Archive::Zip->new(); $zip1->addFile( 'c:/Perl/bin/ans1.txt' ) or die 'unable to add file to archive'; $zip1->writeToFileNamed('test1.zip'); # Archive::Zip Synopsis (with ALL CAPS DIRECTORY NAME) my $zip2 = Archive::Zip->new(); $zip2->addFile('c:/Perl/bin/ans1.txt' ) or die 'unable to add file to archive'; $zip2->writeToFileNamed('tests.zip'); # Archive::Tar Synopsis (relative path to directory) #my $tar3 = Archive::Tar->new;$tar3->add_files( 'MyArchiveFiles/file1. +txt' )or die 'unable to add file to archive';$tar3->write('test3.tar' +); print "Finished successfully!";

Replies are listed 'Best First'.
Re^3: Creating a .zip file using perl
by AATG_PERL_1010 (Initiate) on Oct 25, 2011 at 11:59 UTC
    This code is working fine for me, but if i use the special characters like "ÅÄÖ" in the filename(like, $zip2->addFile('c:/Perl/bin/Åns1.txt' ) then the filename within the zip file is like c:/Perl/bin/+ns1.txt. So this code is not working properly for special characters. Please post if you know to zip the file which contain "ÅÄÖ". Thanks in advance

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://903102]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2024-04-24 17:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found