Greeetings.
I have a windows folder full of .tif files, with names like:
123-monday.tif
234-monday-1of2.tif
345-monday-2of2.tif
I have pooly crafted a script to read all the filenames in the directory, pull out the day and create a zip called monday.zip
My problem is it willput these 3 files in, but each time it moves to the next file it removes the previous file. So as an example once the script is run the only file I have in the zip is 345-monday-2of2.tif. I tested by putting in a sleep command, stopping the script and looking in the zip, at the point I stopped it I could see it was putting the previous file in, but once it goes forward it kills the contents.
I am not declaring the zip name, I read the filename, extract the day and name it monday.zip.
my $zip = Archive::Zip->new();
my $member = $zip->addDirectory( 'dirname/' );
$member->desiredCompressionMethod();
$member = $zip->addFile( "$file_to_zip", "$file_name" );
+
die 'write error' unless $zip->writeToFileNamed( $zip_file_name )
+== AZ_OK;
is there a way to make it not clear the zip file? I want this so each day it can scan a directory and add files to the already existing zip. Did I explain well enough?
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.