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

Net FTP question

by omegaweaponZ (Beadle)
on May 24, 2013 at 16:37 UTC ( #1035173=perlquestion: print w/ replies, xml ) Need Help??
omegaweaponZ has asked for the wisdom of the Perl Monks concerning the following question:

Really simple question..... using Net::FTP and placing a script on a cronjob, how can I specify to stop getting the remote file and placing it in the root! Running it locally, this places it where I have my script. Probably a simple change, but here is my script:
$dir = "/log"; $ftp->cwd($dir) or die "Can't cwd to $dir\n"; $get = "filename.file from remote server" $ftp->get($get) or die "Can't get $get \n";
So this grabs it correctly from the remote server on /log/filename.file but when transferred, it goes to the root / instead of where I want it to go, which is /var/log. How can I specify where to place the new file I am ftping?

UPDATE: Disregard, you can specify remote file location within the get command: ftp->get($get,/path/to/local);

Comment on Net FTP question
Download Code
Re: Net FTP question
by runrig (Abbot) on May 24, 2013 at 17:43 UTC
    Read the docs for Net::FTP. $ftp->get(..) can take an optional second argument to specify the local file.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (10)
As of 2014-12-17 21:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (34 votes), past polls