Currently have a subroutine that works that gathers filesize information of zip files. I'm looking to turn this into a more pure perl solution for speed purproses (I need to do this over millions of files).
I looked in Archive::Zip and Archive::Unzip and wasn't really finding anything. For tarballs I was able to do this with Archive::Tar->list_archive for tarballs.
Current working code
sub CollectZip { my ($location) = shift; my @zipListData = `unzip -l \'$location\'`; chomp @zipListData; ### Get rid of the first 3 rows and last 2 rows shift(@zipListData); shift(@zipListData); shift(@zipListData); pop(@zipListData); pop(@zipListData); my %filesData; foreach my $zipData (@zipListData) { $zipData =~ tr/ //s; my @zipData = split(/ /, $zipData); my ($zipFilesize) = $zipData[1]; my ($zipFilename) = $zipData[4]; $filesData{$zipFilename} = $zipFilesize; } print Dumper \%filesData; return %filesData; }
In reply to Unzip -l replacement by sirhalos
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |