Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: how to zip files using perl

by dynamo (Chaplain)
on Oct 10, 2007 at 17:54 UTC ( [id://644044]=note: print w/replies, xml ) Need Help??


in reply to how to zip files using perl

If you're on a mac (or unix machine with the 'zip' utility installed), the simplest way to do it is with backticks. I'll assume you just generated file1.html, file2.css, and file2.png. I'm also assuming you'd want to use the name files.zip.
my @files2zip = qw/file1.html file2.css file3.png/; my $fileStr = join(" ",@files2zip); my $zipfile = "files.zip"; my $output = `zip $zipfile $filesStr`; print "Progress:\n$output\n\nYour files are in [$zipfile].";
If you don't have the zip cmdline util handy, consider tar -z, it's not the same but it compresses decently. Failing that, or if you prefer, check out the previous post about the CPAN module.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-04-23 15:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found