Re: ftp scripts


Subject: Re: ftp scripts
From: Mike Baker (mikelbaker@yahoo.com)
Date: Wed Jul 10 2002 - 12:15:46 AKDT


 Thanks to everyone that answered. This is what I was looking for. I'd never heard of expect or wget and so didn't know to use them.
 
Thanks
Mike
  Mike Tibor <tibor@lib.uaa.alaska.edu> wrote:
On Wed, 10 Jul 2002, Mike Baker wrote:

>
> Is there a mechanism to have an ftp script in linux like there is in
> Windows. I want to log into a number of computers to ftp some data
> extracts. I have batch files in windows that I can schedule and
> figure that there must be a way to do this in Linux also. In windows
> you pass a command file to ftp that it reads and then executes the
> commands in order. When I do a man ftp I don't see this option.

It should be easy enough to write an expect script to do this. It could
even be as simple as:

#!/usr/bin/expect --

spawn ftp
expect "Name"
send "\r"
expect "Password:"
send "
\r"
expect "ftp>"
send "cd /some/directory\r"
expect "ftp>"
send "bin\r"
expect "ftp>"
send "get somefile\r"
expect "ftp>"
exit

You might want to add a few lines to handle errors or other things though.

Mike

-- 
Mike Tibor Univ. of Alaska Anchorage (907) 786-1001 voice
Network Technician Consortium Library (907) 786-6050 fax
tibor@lib.uaa.alaska.edu http://www.lib.uaa.alaska.edu/~tibor/
http://www.lib.uaa.alaska.edu/~tibor/pgpkey for PGP public key

--------- To unsubscribe, send email to with 'unsubscribe' in the message body.

--------------------------------- Do You Yahoo!? New! SBC Yahoo! Dial - 1st Month Free & unlimited access

--------- To unsubscribe, send email to <aklug-request@aklug.org> with 'unsubscribe' in the message body.



This archive was generated by hypermail 2a23 : Wed Jul 10 2002 - 12:15:52 AKDT