Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

SOLVED: Archive::Zip unable to unzip with native windows 7

by gman (Friar)
on Mar 09, 2012 at 19:32 UTC ( [id://958783]=perlquestion: print w/replies, xml ) Need Help??

gman has asked for the wisdom of the Perl Monks concerning the following question:

UPDATE: SOLVED,, thank you ww for your answer. It was correct, I striped the path form the file and it works correctly now!

UPDATE: more info: example of unzip on another linux box.
Also, if I use zip from linux, I can unzip the file in windows
root@:/var/www/pcap# unzip -t wpb.eth1.03_09_12_14-3104.pcap.zip Archive: wpb.eth1.03_09_12_14-3104.pcap.zip testing: /root/pcap/wpb.eth1.03_09_12_14-3104.pcap OK No errors detected in compressed data of wpb.eth1.03_09_12_14-3104.pcap.zip. root@:/var/www/pcap#

Windows error: "The Compressed (zipped) Folder 'c:\<file path>' is invalid"

Hello All,

I am using Archize::Zip in Ubuntu server (Linux Snifferone 3.0.0-16-server #28-Ubuntu SMP Fri Jan 27 18:03:45 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux), Archive::Zip is up to date (1.30).

It seems to compress just fine, and I can unzip them on another unix box using unzip utility. But when transfered to a windows 7 system, I am unable to unzip using the native windows extract. I believe I am missing a library on the linux, but I am at a loss here.

Thanks, in advance!

Here is my code snip

sub zipfiles { my $path = shift; my $tree_hash_ref = shift; foreach my $file ( keys %$tree_hash_ref ) { $file = "$path$file"; print "DEBUG: zipping $file\n"; my $zip = Archive::Zip->new(); my $file_member = $zip->addFile("$file"); my $fh = IO::File->new( "$file.zip", 'w' ); $fh->binmode; unless ( $zip->writeToFileHandle($fh) == 0 ) { $fh->flush; $fh->close; } $fh->close; print "DEBUG: unlinking $file\n"; unlink($file); } }

Replies are listed 'Best First'.
Re: Archive::Zip unable to unzip with native windows 7
by ww (Archbishop) on Mar 09, 2012 at 20:33 UTC
    If you're attaching a Linux path when zipping, a Windows unzip might well choke on the (foreign to 'doze) path. <update - forgot to mention> Your assertion that you succeed when "use(ing) zip from linux" to unzip the file at the Windows ip may tend to support that hypothesis.</update>

    IIRC, Windows unzip does (or used to) offer retaining or ignoring the path found in the .zip file. Is it worthwhile to experiment with telling it to ignore that path?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://958783]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-04-23 07:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found