|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi, guys, my question is:
I used Net::FTP in my script and try to download some zipped files from an ftp website. After downloading I need to unzip them. But the 'gunzip' always complain about those .gz files with "-CRC error" and "-Length error". So I checked the size of downloaded files and found they are several bytes shorter than they are supposed to be. Then I tried to ftp to the site and use 'get' command to download files one by one at the command line. This is successful and the length of files are good and files are unzipped correctly this time. Now I believe this is NOT a gunzip problem but a FTP problem. I don't know why FTP transfered the files but with incorrect size. Could anybody help me out? Really appreciate! Urgent. Alan ---------------------------------------- part of my code looks like: my $ftp = Net::FTP->new($host, Port=>21, Timeout=>180) || die "Could not connect: $host!" unless $ftp; $ftp->login("anonymous", $email) || die "Login failed"; $ftp->cwd($dir) || die "Directory $dir doesn't exit"; foreach $_ (keys %src) { my $file = $src{$_}->{'file'}; $ftp->get($file) || die "can not get $file!"; print "$_: $file is downloaded!\n"; #uncompressing NCBI LocusLink data file if($file =~ /gz/) { my $f = $file; $f =~ s/.gz//g; `rm $f`; `gunzip $file`; $file =~ s/.gz//g; `mv $f $root_dir/local_dir`; print "$_: $file is unzipped!\n"; } } $ftp->quit; Platform: UNIX Version: Perl 5.6 |
|
#2
|
||||
|
||||
|
try to make sure you set type to BINARY before do a get()
... $ftp->binary(); # then do $ftp->get($file) || die "can not get $file!";
__________________
Help me, help you, help others...
|
|
#3
|
|||
|
|||
|
Re: Use Net::FTP download file has length error
Thanks much for your kind reply. It works fine now. Another minor question is: I had tried to use `get $file` to download and got a error msg as " not an SCCS file col(1)". I'm just curious about what this means.
Have a nice weekend! Alan ----------------------------------------------------- Quote:
|
|
#4
|
||||
|
||||
|
humm... I believe SCCS is a source control program. I don't understand why you would get that error message when doing a get command from ftp. Maybe other can help you more.
![]() |
|
#5
|
||||
|
||||
|
It could be that the SCCS server is configured to use port 21, and that maybe the FTP service is on another port
Just a guess Ax |
![]() |
| Viewing: Dev Shed Forums > System Administration > FTP Help > Use Net::FTP download file has length error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|