in reply to Renaming a file within a zip

doc says it can be used to rename "members", it doesn't actually show how

It's a little hard to find, see the section "Member Operations":

fileName() / Get or set the member's internal filename.

This works for me:

use Archive::Zip qw/:ERROR_CODES :CONSTANTS/; my $zip = Archive::Zip->new(); $zip->read('/tmp/foo.zip')==AZ_OK or die "read"; for my $member ($zip->members) { next if $member->isDirectory; my $fn = $member->fileName; $fn =~ s/foo/bar/; $member->fileName($fn); } $zip->overwrite==AZ_OK or die "write";

Update: My 1111th node! :-)

Replies are listed 'Best First'.
Re^2: Renaming a file within a zip
by palkia (Monk) on Oct 07, 2017 at 03:14 UTC
    Works for me too.
    Thank you very much for helping me figure this out and for the relevant and generally useful link. ☺