Subject: Re: ftp scripts
From: Mike Tibor (tibor@lib.uaa.alaska.edu)
Date: Wed Jul 10 2002 - 10:36:32 AKDT
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 <hostname>
expect "Name"
send "<username>\r"
expect "Password:"
send "<password>\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 <aklug-request@aklug.org> with 'unsubscribe' in the message body.
This archive was generated by hypermail 2a23 : Wed Jul 10 2002 - 10:36:34 AKDT