Redian新闻
>
can anyone post a FTP auto get script ?
avatar
can anyone post a FTP auto get script ?# Unix - 噫吁兮,危乎高哉
d*c
1
I saw a ftp script before, which could do auto connection and fetch files
from hosts. what I'm interested in is its login part.
But I could not remember how exactly it is written now.
only remember it used something like
...
cat > ftp host << EOF
{ login part with usrname, passwd..}
EOF
....
{ getting files part }
...
does anyone how to do that login part ? thanx !
avatar
l*l
2
you should using .netrc to config your account. Then:
{
bin
put sth
..
..
} | ftp host

【在 d***c 的大作中提到】
: I saw a ftp script before, which could do auto connection and fetch files
: from hosts. what I'm interested in is its login part.
: But I could not remember how exactly it is written now.
: only remember it used something like
: ...
: cat > ftp host << EOF
: { login part with usrname, passwd..}
: EOF
: ....
: { getting files part }

avatar
m*n
3
in your script
ftp -n host <user username password
#bin
#prompt
#hash
#getting files
bye
EOF
or you can put them in the $HOME/.netrc as mention above

【在 d***c 的大作中提到】
: I saw a ftp script before, which could do auto connection and fetch files
: from hosts. what I'm interested in is its login part.
: But I could not remember how exactly it is written now.
: only remember it used something like
: ...
: cat > ftp host << EOF
: { login part with usrname, passwd..}
: EOF
: ....
: { getting files part }

avatar
b*x
4
And you can use expect to do it. A sample expect script /usr/bin/ftp.expect
is doing exactly the task you described.

【在 m******n 的大作中提到】
: in your script
: ftp -n host <: user username password
: #bin
: #prompt
: #hash
: #getting files
: bye
: EOF
: or you can put them in the $HOME/.netrc as mention above

avatar
t*l
5
I tried to download several thousands of files from another
machine (in LAN) using expect, but it stoped after no more
than 200 files, then it just stopped. I tried several times,
it always failed. I don't know if expect is not stable or my
script has problem. I just did some change to ftp.expect. If
it has error, it should start work from the very beginning :((
So at last I have to go back to ftp script.

【在 b***x 的大作中提到】
: And you can use expect to do it. A sample expect script /usr/bin/ftp.expect
: is doing exactly the task you described.

avatar
w*g
6
1. "mget" in ftp will help you get multiple files, have you tried it?
or get "get" using ncftp, take advantage of wildcards
2. wget -i input, where input is a list of file names
(not very efficient if files are small, since wget logins for each DL)

【在 t*********l 的大作中提到】
: I tried to download several thousands of files from another
: machine (in LAN) using expect, but it stoped after no more
: than 200 files, then it just stopped. I tried several times,
: it always failed. I don't know if expect is not stable or my
: script has problem. I just did some change to ftp.expect. If
: it has error, it should start work from the very beginning :((
: So at last I have to go back to ftp script.

avatar
t*l
7
hehe, you think I put get image001001.tif ... image200200tif there?:)
anyway, thanks for your reply.

【在 w*****g 的大作中提到】
: 1. "mget" in ftp will help you get multiple files, have you tried it?
: or get "get" using ncftp, take advantage of wildcards
: 2. wget -i input, where input is a list of file names
: (not very efficient if files are small, since wget logins for each DL)

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。