> Dan Muey wrote:
> > I'm looking at Archive::Zip to extract a single text file
> from a zip
> > file that is ftped from a winders box to a unix box.
> >
> > The zip file conatins only one file, a .txt file, that is
> compressed
> > pretty well. (about 170 MB regular 18MB zipped up)
> >
> > Data.txt is apx 170MB
> > Data.txt is zipped into 'data.zip' which is 18MB
> > File 'data.zip' is ftped from winders to unix server
> > Now heres' where my perl script comes in:
> >
> > Perl/Archive::Zip (or other module???)
> > Extracts data.txt from data.zip and writes it to 'local_data.txt'
> >
> > Any pointers/ideas/experience about how to do that?
>
> Hi Dan.
>
> The program below is the very basic stuff to do what you
> want. It does no error checking except to make sure that the
> zip file opened OK, and just extracts the first file in the
> archive with to a file with a name prefixed with "local_".
> You probably need some exception handling, but how much
> depends on your data.
>
> HTH,
>
> Rob
>
>
> use strict;
> use warnings;
>
> use Archive::Zip;
>
> my $zip = Archive::Zip->new('data.zip') or die "Failed to
> open zip file";
>
> my ($member) = $zip->members;
For grins, if I understand this right this would allow me to extract a couple files
based ontheir name:
my $zip = Archive::Zip->new('data.zip') or die "Failed to open zip file";
my @members = $zip->members;
for(@members) {
if($_->fileName =~ 'super.txt') {
$_->extractToFileNamed("local_super.txt");
if($_->fileName =~ 'two.txt') {
$_->extractToFileNamed("local_two.txt");
}
Just curiose if my understanding of this obdject is semi correct.
Thanks
Dan
> my $file = $member->fileName;
>
> $member->extractToFileNamed("local_$file");
>
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]