Subject: | BUG: files with paths in zips are invisible using Windows Explorer |
Date: | Fri, 19 Jul 2013 18:32:17 -0700 |
To: | bug-Archive-Zip [...] rt.cpan.org |
From: | Alan Sinclair <anadem [...] gmail.com> |
Using Archive::Zip to make a zip file that includes files in subdirectories
results in a package in which Windows Explorer cannot see the files in
subdirectories. Only files with no path information are visible.
For example the following code packages one file from the current
directory, and one from a subdirectory. When the zip file is opened in
WIndows Explorer the subdirectory and its file are not visible.
Tools such as gnu zip, 7zip, WinZip, etc can see subdirectories OK, so I
guess this may be a Windows bug, but hope it can be fixed in the
Archive::Perl module. (Log in to the CPAN bug archive with OpenID fails,
so I can't look for prior submissions or conversations about this.)
# this is perlzip.pl
use strict;
use Archive::Zip;
my @files_to_get = (
{ files => "perlzip.pl" }, # in current directory
{ files => ".\\temp\\dummy.txt" }, # in a sub 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;
Regards
Alan Sinclair