Hello
I have to rename the file inside a zip archive as well as the zip archive itself. the zip file and folder is called ATP.xxxxxx.zip and a file inside the zip is called identically ATP.xxxxx and I need to rename both the zip and the file inside the zip and remove the "ATP."
I tried this code but it does not workthe zip file cannot be read..#!/usr/bin/perl -w use warnings; use strict; use Archive::Zip qw( :ERROR_CODES ); my @files; @files = <ATP.xxxxxx*.zip>; foreach my $file (@files){ my $zip = Archive::Zip->new(); $zip->read('$file') == AZ_OK or die "read error $!"; $file=~ s{\.[^.]+$}{}; my $m1 = $zip->memberNamed('$file'); $file=~s/^.{4}//s; $m1->fileName('$file'); $zip->overwriteAs('$file.zip') == AZ_OK or die "write error $!\n" }
In reply to rename zip files and folders inside zip files by mariog
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |