D
david
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 qwERROR_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'
How can I get around this?
Thanks,
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 qwERROR_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'
How can I get around this?
Thanks,