I'm using Achive::Zip (with perl v5.14.4) to gather various log files on Windows. Unfortunately Windows Explorer cannot see any directories inside the zip file, though unzip, 7zip, winzip, etc can see them. I guess this can be waved aside as a Windows problem, not Perl, but any ideas will be helpful.
Here's a minimal example:
# this is perlzip.pl
use strict;
use Archive::Zip;
my @files_to_get = (
{ files => "perlzip.pl" }, # in current directory
{ files => "\\alans\\dummy.txt" }, # in another dir
);
my $zip = Archive::Zip->new(); # new zip object for packaging
foreach my $href ( @files_to_get ) {
my $file = $href->{"files"};
print( " adding $file\n" );
$zip->addFile( $file );
}
$zip->writeToFileNamed( "MyZip.zip" );
exit;
To try that you need two files: ".\perlzip.pl" and "\alan\dummy.txt"
Using backslashes or forward-slashes as directory delimiters in the script makes no difference. In no case can Windows see paths in the zip file, and in all cases other zip tools can. Archive::Zip is probably using forward-slashes itself, which Windows is refusing to see.
If anyone can SUGGEST A SOLUTION it will be VERY much appreciated.
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.