Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Net::FTP and Zip files

by esolm (Acolyte)
on Mar 19, 2001 at 11:45 UTC ( [id://65382]=perlquestion: print w/replies, xml ) Need Help??

esolm has asked for the wisdom of the Perl Monks concerning the following question:

Anyone out there have problems with NET::ftp and zip files. The file keeps comming down corrupted - when I get the file using standard win2000 ftp cleint the file is ok. so the file is not the problem.

Any help would be appreciated.
#!/usr/bin/perl # file name here use warnings; use strict; use Net::FTP; use File::Copy "cp"; # ****************************************************** # SECTION 1 CHECK TO SEE IF THERE IS A NEW FILE ON JANUS # ****************************************************** # log into xxxxx with perl chdir "d:/cds_data/latest_download/"; my $ftp = Net::FTP->new("xxxxxxxxxx") or die "Couldn't connect: $@\n"; $ftp->login("xxxxxx", 'xxxxxxxx'); $ftp->cwd("/pushus/download"); $ftp->binary; $ftp->pasv; $ftp->get("download.zip"); $ftp->close; print "Th Th Tha That's All Folks!!!!!", "\n";

Replies are listed 'Best First'.
Re: Net::FTP and Zip files
by sachmet (Scribe) on Mar 19, 2001 at 12:11 UTC
    Funny...
    #!/usr/bin/perl use warnings; use strict; use Net::FTP; my $ftp = Net::FTP->new("ftp.cdrom.com") or die "Couldn't connect: $@\n"; $ftp->login("ftp", 'warez@'); $ftp->cwd("/.2/simtelnet/gnu/djgpp/v2/"); $ftp->binary; $ftp->pasv; $ftp->get("faq230s.zip"); $ftp->close; print "Th Th Tha That's All Folks!!!!!", "\n";
    (file chosen at random from simtelnet at cdrom)

    This works as expected, and the zip downloads fine, at least on a UNIX system. One other thing I'd try: place binmode() towards the top of the program; see how that fares. Perl may be converting your "\n" to "\r\n", which is not what you'd want.

    Further, check the return of $ftp->get for the filename and check the filesizes to see if they're identical. Also, make sure the file doesn't exist first on the local side, if at all possible.
Re: Net::FTP and Zip files
by Anonymous Monk on Mar 19, 2001 at 12:13 UTC
    Nevermind - its working!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://65382]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2024-04-25 15:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found