guzziee has asked for the wisdom of the Perl Monks concerning the following question:
I have some zip files that contain .gz files in them and each one is an xml file, is there a way to extract the xml's, here's what I got so far: I'm able to print the gzip names inside the zip, but not sure how to go about extracting them. Thanks!
#!/home/cnda/master/bin/perl/bin/perl use strict; use warnings; use IO::Compress::Zip; use File::Spec::Functions qw(splitpath); use IO::File; use IO::Uncompress::Unzip qw($UnzipError); use File::Path qw(mkpath); $path = $ARGV[0]; @list = `find $path -name '*zip' -type f`; foreach(@list){ my $zipFile = IO::Uncompress::Unzip->new($_); while (my $status = $zipFile->nextStream()) { my $zipEntryHeader = $zipFile->getHeaderInfo(); my $pathAndFilename = $zipEntryHeader->{Name}; print "$pathAndFilename\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: .gz inside a zip
by huck (Prior) on Sep 11, 2017 at 02:10 UTC | |
|
Re: .gz inside a zip
by karlgoethebier (Abbot) on Sep 11, 2017 at 09:31 UTC |