Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: lcd in Net::FTP module

by derby (Abbot)
on Aug 04, 2009 at 11:04 UTC ( #785719=note: print w/ replies, xml ) Need Help??


in reply to lcd in Net::FTP module

While lcd makes sense when you're in an interactive FTP session, you really don't need it when scripting (at least with perl) -- use the built-in chdir function:

use Net::FTP; my $ftp = Net::FTP->new("some.host.name", Debug => 0) or die "Cannot connect to some.host.name: $@"; $ftp->login("anonymous",'-anonymous@') or die "Cannot login ", $ftp->message; $ftp->cwd("/pub") or die "Cannot change working directory ", $ftp->message; chdir "/tmp" or die "Cannot change local directory ", $!; $ftp->get("that.file") or die "get failed ", $ftp->message; $ftp->quit;
(modified from the example at Net::FTP).
-derby


Comment on Re: lcd in Net::FTP module
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://785719]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2015-07-05 09:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (61 votes), past polls