Hello expat, and welcome to the Monastery!
Use the addFileOrDirectory method and set zipName to the desired destination:
#! perl use strict; use warnings; use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); my $dirname = 'Foo/'; my $filename = 'Bar.txt'; my $zip = Archive::Zip->new(); $zip->addDirectory($dirname); $zip->addFileOrDirectory( { name => $filename, zipName => $dirname . $filename } ); $zip->writeToFileNamed('test.zip') == AZ_OK or die "Write error: $!";
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: directories in Archive::Zip
by Athanasius
in thread directories in Archive::Zip
by expat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |