in reply to Zip/compress files and directories

OK. So I hav made headway. I am now using Archive::Zip. I have been able to add the files in the local directoy to the archive, but have not been able to add a subdirectoy in the current directory to the archive. Here is the code I have. Any assistance?
sub compress { @add_array=@{ $_[0] }; $obj = Archive::Zip->new(); # new instance foreach (@add_array) { $obj->addFile($_); # add files } if ($obj->writeToFileNamed("$ZIP") != AZ_OK) { # write to disk print "Error in archive creation!"; } else { print "Archive created successfully!"; } } opendir(DIR, "."); @files = grep(/^AAA_/,readdir(DIR)); closedir(DIR); push(@files,"./support"); # <== Seems not to be working compress(\@files);

Replies are listed 'Best First'.
Re^2: Zip/compress files and directories
by johngg (Canon) on Jan 31, 2009 at 21:51 UTC

    You may find the documentation helpful. It suggests to me that you might need the addTree() method.

    Cheers,

    JohnGG