FTP Command input from file?

L. Scott Emmons scott at csusac.csus.edu
Tue Jan 9 15:50:40 AEST 1990


In article <991 at manta.NOSC.MIL> psm at manta.nosc.mil.UUCP (Scot Mcintosh) writes:
>I want FTP to execute a canned set of commands from a
>local file as though I had typed them from the console.

You need to do two things to make this work.

1> set up a .netrc file in your home directory.  The format is (At least on our
   flavor of unix, so you may wish to check documentation; but I don't expect
   it to be different...):

machine <machine_name> login <login_name> password <password>

   for example, my .netrc entry for simtel20 is:

machine simtel20.arpa login anonymous password guest

2> once the .netrc file is set up, you just redirect stdin into ftp from the
   file of commands, which MUST END WITH THE 'bye' COMMAND.

   for example if I wish to get the file "blather.tar-Z" from the
   "pd2:<unix-c.somedir>" directory, and let's say, deposit it in my local
   "ftp/unix/source" directory, my file would read:

lcd ftp/unix/source
cd pd2:<unix-c.somedir>
tenex
get blather.tar-Z
bye

   and from the prompt:

o% ftp simtel20.arpa <myfile

   That's all there is to it!  Enjoy!!!

-- 
			L. Scott Emmons
			---------------
		...[!ucbvax]!ucdavis!csusac!scott
		ucdavis!csusac!scott at ucbvax.berkeley.edu



More information about the Comp.unix.questions mailing list