Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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 perusing the Monastery: (16)
As of 2014-07-10 19:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (215 votes), past polls