Hi Monks!
I am using this module Archive-Zip and it is working fine, but when a file gets zipped it is also making a duplication of it. I found some help on their website, but I can't understand what they mean here:
From the help page:
"Duplicate files in Zip? ^
Q: Archive::Zip let me put the same file in my Zip twice! Why don't you prevent this?
A: As far as I can tell, this is not disallowed by the Zip spec. If you think it's a bad idea, check for it yourself:"
$zip->addFile($someFile, $someName) unless $zip->memberNamed($someName
+);
"I can even imagine cases where this might be useful (for instance, multiple versions of files)."
Whatever they are asking to be done to correct the issue doesn't work. I wonder if anyone here had the some problem with that.
Here is some of my code:
$zfile = $pathtofile;
$zip = Archive::Zip->new();
my $zipped;
#Chopped log files and Zipped files will be created in the directories
+ below:
my $zip_file = $path_only."/".$file_name.".zip";
$zipped = $zip->addFile($zfile);
$zipped->desiredCompressionMethod( COMPRESSION_DEFLATED );
find(\&zip_file, $dir);
die 'write error' unless $zip->writeToFileNamed( $zip_file ) == AZ_OK;
sub zip_file {
my $zipped = $zip->addFile( $File::Find::name );
if ($File::Find::name =~ m/\.txt$/i){
my $zipped = $zip->addFile( $File::Find::name );
}
Thanks for the Help!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.