"david" <> wrote in message
news: m...
> I have a script to extract any ZIP files in the current directory. The
> problem is when they are extracted, the program puts a . in front of
> the file names.
>
> #!/usr/bin/perl -w
>
> use strict;
> use Archive::Zip qw(:ERROR_CODES);
>
> opendir(DIR, ".") || die "Can't open local directory : $!";
> my @zips = grep { -f "./$_" } readdir (DIR);
> close(DIR);
> foreach my $zipfiles (@zips) {
> if ($zipfiles =~ /\w+\.zip$/) {
> my $zip = Archive::Zip->new();
> my $zipName = "$zipfiles";
> my $status = $zip->read( $zipName);
> die "Read of $zipName failed\n" if $status != AZ_OK;
> print "$zipfiles\n";
> $zip->extractTree();
> #unlink($zipfiles);
> }
>
> }
>
> If I have a file called a.zip with a file in it called 'a', the script
> will extract it as '.a'
>
I don't think Archive::Zip is supposed to do this - but it does (for me on
Win2k, perl 5.6.1).
> How can I get around this?
>
I think you'll get around it with :
$zip->extractMember($member_name);
See Archive::Zip docs.
Hth,
Cheers,
Rob
|