我有
host name : "ftp.flowers.com"
username : "name"
password : "123"
directory path : "/flower/rose"
我必须从中下载“红色”文件。以下脚本无法正常工作
ftp -in ftp.flowers.com << SCRIPTEND
user name 123
binary
cd /flower/rose
mget red
SCRIPTEND
答案 0 :(得分:15)
使用wget
:
wget ftp://name:123@ftp.flowers.com/flower/rose/red
答案 1 :(得分:1)
大家已经太晚了,你现在可能已经解决了你的问题。但无论如何我想知道你是否用其他任何替代方法解决了它:
我注意到你在下面的脚本中发生了一些细微的变化,我猜这是&#34; /&#34;这个位置&#34; cd / flower / rose&#34;
之后你就错过了ftp -in ftp.flowers.com << SCRIPTEND
user name 123
binary
cd /flower/rose/
mget red
SCRIPTEND
答案 2 :(得分:0)
wget --user=name --password=123 ftp://ftp.flowers.com/flower/rose/red
To download to a different directory than the current directory:
wget --user=name --password=123 directory-prefix=/the/target/directory/ ftp://ftp.flowers.com/flower/rose/red
Then the files will be downloaded to /the/target/directory/
.
If you know the name of the file ahead of time, you can use the -O option to wget to tell it where to write the file:
wget --user=name --password=123 --output-document=/the/target/directory/red ftp://ftp.flowers.com/flower/rose/red