Saturday, 10 August 2013

Use FTP command line to get file with absolute path

Use FTP command line to get file with absolute path

I am wondering if with an FTP command line utility, you can use the FTP
get command to get a file with an absolute path, as opposed to having to
cd into each successive directory to get a file.
When I type
ftp> get pub/sdc.tgz
Or even this (with one or two slashes before pub)
ftp> get /pub/sdc.tgz
It tells me it cannot find the file:
local: /pub/sdc.tgz remote: /pub/sdc.tgz
ftp: local: /pub/sdc.tgz: No such file or directory
However when I instead do
ftp> cd pub
ftp> get sdc.tgz
It works totally fine.
Is there any correct syntax in the ftp command line to get a file with an
absolute path, or do I need to cd into pub first to do it?
(FYI: What I am trying to do is use a PERL script that runs daily that
saves a file to an FTP server, then a later script that will 1. get the
file -- which I am not opposed to using wget to do -- and 2. delete the
file after I get it, which I need to do with FTP. I want the file to be
deleted by the second script, so that in the future if the first script
has trouble saving the file to the FTP server, the second script will know
that there was an error because the file is not there. I could save it
with different names too, but I do not want to pollute the FTP server with
a ton of files from different days.)

No comments:

Post a Comment