d***c 发帖数: 13 | 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 ! |
l*l 发帖数: 225 | 2 you should using .netrc to config your account. Then:
{
bin
put sth
..
..
} | ftp host
【在 d***c 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 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 }
|
m******n 发帖数: 497 | 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 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 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 }
|
b***x 发帖数: 161 | 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 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 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
|
t*********l 发帖数: 30 | 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 的大作中提到】![](/moin_static193/solenoid/img/up.png) : And you can use expect to do it. A sample expect script /usr/bin/ftp.expect : is doing exactly the task you described.
|
w*****g 发帖数: 198 | 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 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 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.
|
t*********l 发帖数: 30 | 7 hehe, you think I put get image001001.tif ... image200200tif there?:)
anyway, thanks for your reply.
【在 w*****g 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 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)
|