Re: Can I list contents of nested zipfile using Archive::Zip without extracting the outermost zip?
From: A. Sinan Unur (1usa_at_llenroc.ude)
Date: 01/11/04
- Next message: A. Sinan Unur: "Re: strip all html but links"
- Previous message: Ben Morrow: "Re: Find external IP-address"
- In reply to: Graham Wood: "Re: Can I list contents of nested zipfile using Archive::Zip without extracting the outermost zip?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 11 Jan 2004 01:17:54 GMT
Graham Wood <dontspamme@oracle.com> wrote in news:3FFFF821.8020606
@oracle.com:
> A. Sinan Unur wrote:
>> Graham Wood <Graham.letterT.Wood@oracle.com> wrote in news:LUBLb.4
>> $mE1.141@news.oracle.com:
>>
>>
>>>I want to do this:
>>>1 open the 123456.zip
>>> read the filename.zip list (I've got this far!)
>>> foreach filename.zip (eg 123456_ar.zip)
>>> list the contents of the filename.zip
>>> }
>>>}
>>>
>>>Can I get there without extracting 1233456.zip first?
>>
>>
>> Have you looked at the docs?
...
> Yes, that's how I "got this far" already.
Fair enough. Sorry I misunderstood your question.
I am not familiar with the Archive::Zip module, but the following script
I cobbled together based on one of the examples seems to work. At first I
thought Archive::Zip::MemberRead would do the job but I ran into some
difficulties.
Here are the contents of the two zip files I used:
C:\Home> unzip -l test1.zip
Archive: test1.zip
Length Date Time Name
-------- ---- ---- ----
2040 01-10-04 20:13 test.zip
-------- -------
2040 1 file
C:\Home> unzip -l test.zip
Archive: test.zip
Length Date Time Name
-------- ---- ---- ----
398 12-04-03 23:13 dload/misc/ddd.pl
793 11-08-03 10:30 dload/misc/g.pl
1460 07-23-03 10:47 dload/misc/r.pl
940 07-23-03 23:40 dload/misc/s.pl
-------- -------
3591 4 files
Here is the script (no error checking):
C:\Home> cat t.pl
#! perl
use strict;
use warnings;
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
use IO::Scalar;
my $zip = Archive::Zip->new('test1.zip');
my $member = $zip->memberNamed('test.zip');
my $member_contents = $member->contents();
my $member_contents_sh = IO::Scalar->new(\$member_contents);
my $member_zip = Archive::Zip->new();
$member_zip->readFromFileHandle($member_contents_sh);
print map { "$_\n" } $member_zip->memberNames();
__END__
C:\Home> t.pl
dload/misc/ddd.pl
dload/misc/g.pl
dload/misc/r.pl
dload/misc/s.pl
HTH.
Sinan.
-- A. Sinan Unur 1usa@llenroc.ude (reverse each component for email address)
- Next message: A. Sinan Unur: "Re: strip all html but links"
- Previous message: Ben Morrow: "Re: Find external IP-address"
- In reply to: Graham Wood: "Re: Can I list contents of nested zipfile using Archive::Zip without extracting the outermost zip?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|