Well, you didn't leave any code, but I'll give you what I just came up with
(I just started using this module a few days ago).  This is a script that
gets all of the files in the c:\temp directory and puts them in a ZIP
archive.  Basically you want to add files as members using the addFile()
method, and when you're done, output the result by using the
writeToFileNamed() method.

############################################

use Archive::Zip;
use strict;
my $zip = Archive::Zip->new();
my $zipname;

if(defined $ARGV[0]){
        $zipname = $ARGV[0];
}else{
        $zipname = "New ZIP Archive.zip";
}

chdir("c:\\temp");
opendir(DIR,".");
my @files = readdir(DIR);

while($_ = shift @files){
        unless($_ =~ /^\.{1,2}$/){
                print "   Adding $_...";
                if(-d $_){
                        opendir(DIR,$_) || warn "Failed to open directory
$_!\n";
                        foreach my $file(readdir(DIR)){
                                unless($file =~ /^\.{1,2}$/){
                                        push @files,$_."\\$file";
                                }
                        }
                }else{
                        if($zip->addFile($_)){
                                print "OK\n";
                        }else{
                                print "Failed!\n";
                        }
                }
        }
}
print "\nFile Selection Complete, writing to \"$zipname\"\n";
$zip->writeToFileNamed("$zipname");
                
#########################################
-----Original Message-----
From: Steven McCaffrey [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 21, 2002 9:22 AM
To: [EMAIL PROTECTED]
Subject: newbie trying to zip files using archive::zip


Hello:

     I am trying to combine text files into a single zip file.  I've seen
the documentation for archive::zip and think this is close to what I need
but am still unsure how to use it.
I want to take file1.txt file2.txt file3.txt ...and output fileall.zip
Any user friendly help is appreciated.  I have activestate Perl 5.6.1.
Also, if I use the archive::zip module on Win32/NT can I then port to Unix?

Thanks,

Steve


--------------------------------------------------------------------------------
This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to