Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: changing filenames using Archive::Zip

by grep (Monsignor)
on May 17, 2009 at 21:58 UTC ( #764558=note: print w/ replies, xml ) Need Help??


in reply to changing filenames using Archive::Zip

Use the members method to get each of the zip members one at a time. Then use extractMember to extract and rename.

use warnings; use strict; use Archive::Zip; my $zip = Archive::Zip->new('foo.zip'); my $file_counter = 0; foreach my $member ( $zip->members ) { my $file_name = $member->fileName; my $extracted_file_name = 'file-'. $file_counter++ . '.foo'; print "extracting $file_name as $extracted_file_name\n"; $zip->extractMember($member, $extracted_file_name); }
grep
One dead unjugged rabbit fish later...


Comment on Re: changing filenames using Archive::Zip
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://764558]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (18)
As of 2015-07-30 20:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls