On Sun, 12 Oct 2003 11:29:40 -0000,
(Greg Bacon)
wrote:
>In article <>,
> Geoff Cox <> wrote:
>
>: The following code creates zip files, each 22 kb in size, but the doc
>: which should be there isn't there ...any ideas why?
>:
>: I can get code to work where I define the file to be zipped and the
>: name of the zip file but trying to go through the whole folder using
>: File::Find is not working ...
>
>You need to tell the module to add the files to the archives. You
>also want to skip directories:
Greg,
Many thanks - all is well now with this code - now next problem!
Instead of using the name of the doc file as the name for the zip file
I would like to name the zip files, doc1.zip, doc2.zip etc
I am not clear where the loop goes?
Cheers
Geoff
> #! perl
>
> use warnings;
> use strict;
>
> use File::Find;
> use Archive::Zip;
>
> my $dir = 'd:/a-keep8/perl/test';
>
> find sub {
> my $name = $_;
> return if -d;
> print ("$name \n");
> my $zip = new Archive::Zip;
> $zip->addFile($name);
> $zip->writeToFileNamed($name . ".zip");
> } => $dir;
>
>Hope this helps,
>Greg