in reply to How to zip directory on windows
I'm not sure what you mean when you say you're "not able to" zip your desired directories. In the documentation for Archive::Zip, there is a description of tree operations. The example they give is:
use Archive::Zip; my $zip = Archive::Zip->new(); # add all readable files and directories below . as xyz/* $zip->addTree( '.', 'xyz' ); # add all readable plain files below /abc as def/* $zip->addTree( '/abc', 'def', sub { -f && -r } ); # add all .c files below /tmp as stuff/* $zip->addTreeMatching( '/tmp', 'stuff', '\.c$' ); # add all .o files below /tmp as stuff/* if they aren't writable $zip->addTreeMatching( '/tmp', 'stuff', '\.o$', sub { ! -w } ); # add all .so files below /tmp that are smaller than 200 bytes as stuf +f/* $zip->addTreeMatching( '/tmp', 'stuff', '\.o$', sub { -s < 200 } ); # and write them into a file $zip->writeToFileNamed('xxx.zip'); # now extract the same files into /tmpx $zip->extractTree( 'stuff', '/tmpx' );
This should help you to get started. Note that this module uses the Unix format for path names (forward slashes), even in Windows.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to zip directory on windows
by Scrat (Monk) on Mar 22, 2006 at 11:16 UTC |