start of central directory not found, Corrupt zip file
- From: "TheAnswer1313" <john_signore@xxxxxxxxxxx>
- Date: 30 May 2006 15:46:17 -0700
hi using perl i tried to download a couple of zip files. They worked
fine but when i went to unzip them, i got that error msg. I have
noticed that when i download the files manually, they are slightly
smaller then when i download them with the script. If anyone can help
me around this issue, it would be great appreciated.
#!/usr/bin/perl -w
use FileHandle;
use LWP::UserAgent;
$ua = LWP::UserAgent ->new;
$baseurl = "http://www.retro***.org/";
$league = 'ml';
for ($year = 00; $year <= 05; $year++) {
my $filename = '200' . $year . $league . '.zip';
my $url = $baseurl . '200' . $year . '/200' . $year . $league .
'.zip';
my $req = HTTP::Request ->new(GET => $url);
my $res = $ua ->request($req);
print STDERR "fetching $filename\n";
if ($res ->is_success) {
my $fh = new FileHandle ">$filename";
if (defined $fh) {
print $fh $res ->content;
$fh ->close;
} else {
print STDERR "could not open file $filename: $!\n";
}
}
else {
print STDERR $res ->status_line, "\n";
}
}
.
- Follow-Ups:
- Re: start of central directory not found, Corrupt zip file
- From: DJ Stunks
- Re: start of central directory not found, Corrupt zip file
- Prev by Date: Re: year not returned by Time::localtime
- Next by Date: Servlet
- Previous by thread: Escaping a plus sign
- Next by thread: Re: start of central directory not found, Corrupt zip file
- Index(es):