![[Toc]](../../toc.gif)
![[Index]](/idx.gif)
Automatically FTP files to or from a client
Source: IBM Technical Document # - 17675356
To automatically FTP files to or from a client do the following:
Create a text file with the FTP commands (see below for an example) Set
the environment variable NETRC with the fully qualified name of the file
with the commands Enter ftp hostname at the command prompt, for example
ftp rs6000
Example for a FTP command file (The machine is rs6000, the userid is
bfw720 and the password is noa):
machine rs6000 login bfw720 password noa macdef init
lcd c:/targetDir
cd d:/sourceDir
bin
get file1.exe
ascii
get file2.txt
bye
You can define more than one macro in the file; each macro must begin
with
machine ... macdef init
Note that you must use the slash / instead of the backslash \ in path
names. You can use all known ftp commands in the file (use the command
help inside of ftp to get a list of all known commands). To automatically
exit ftp after executing the commands the last command in the macro must
be bye.
To define different commands for one host use hostname aliase: Add the
aliase to the file /etc/hosts like
10.71.24.1 rs6000 rs6000a rs6000b rs6000c
and define different macros for each hostname.
Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs