[vox-tech] Net::FTP - filesize difference
Peter Jay Salzman
p at dirac.org
Wed Aug 12 12:51:32 PDT 2009
On Tue 11 Aug 09, 5:40 PM, Peter Jay Salzman <p at dirac.org> said:
> Remote site:
>
> 150 Here comes the directory listing.
> -rw-r--r-- 1 504 507 204942095 Aug 07 19:58 bvd.zip
> drwxrwxrwx 2 504 0 16384 Aug 05 16:00 lost+found
> 226 Directory send OK.
>
>
> My code:
>
> sub downloadFile()
> {
> use vars qw( %props );
>
> my $ftp = Net::FTP->new( $props->{'ftp.hostname'}, Debug => DEBUG )
> or die "Cannot connect to some.host.name: $@";
> $ftp->binary();
>
> $ftp->login( $props->{'ftp.username'}, $props->{'ftp.password'} )
> or die "Cannot login ", $ftp->message;
> $ftp->get( $props->{'ftp.filename'} )
> or die "get failed ", $ftp->message;
>
> $ftp->quit;
> }
>
>
> The problem:
>
> The downloaded file appears to be either truncated or corrupted.
>
> When I download the file by hand, the size is correct and the file is
> uncorrupted. However, when I download the file using Perl, the file size
> is smaller than what it should be.
>
> -rw-rw-r-- 1 qfa qfr 204939227 Aug 11 17:24 bvd.zip.byPerl
> -rw-rw-r-- 1 qfa qfr 204942095 Aug 11 17:15 bvd.zip.byhand
>
> Any ideas what could be happening?
>
> Thanks!
> Pete
Don't have a copy of the replies handy, so I'll reply to the original msg.
Apparently, binary() is more of a command than a state variable. It needs
to be issued *after* logging in, but before the file transfer.
Good intuition, Bill!
Pete
More information about the vox-tech
mailing list