next up previous contents index
Next: rcp Up: ftp Previous: Usage Notes:

Examples:

Imagine you have to be up to date on remote files which change frequently. You will have to perform the same file transfer quite often. A shell script similar to the following would be very useful:

 
# getfiles: get a few files regularly from DXCERN

#

# customize the next lines:

user=XY12 # replace this with your id

locpath=... # specifies where to put

rempath=... # from where to get

#

echo " "

echo "Opening FTP connection to DXCERN"

echo "for user" $user

echo " "

ftp -n dxcern <<EOF # invoke FTP with next lines as input

user $user # specifies remote user id

lcd $locpath # set the local path

cd $rempath # set the remote path

get file1 # with EBCDIC/ASCII conversion

binary # change transfer mode

get file2 # without conversion

quit # terminate FTP

EOF # terminate input to FTP

You will be prompted for your password on the remote host.

``Anonymous'' ftp  means that one can login to the remote system using the userid of ``anonymous'' and password of either ``guest'' or more usually your own userid and internet address. Ftp is like telnet in that the ``open'' command and access to the remote host is similar, except that you can only access files in the subdirectory tree belonging the remote anonymous ftp account.

A typical session might go as follows:

 
		  ftp  any.host.i.know

login: anonymous

guest login ok...send user id as password

ftp> ls -al ( list all files)

ftp> cd pub ( change to the ``pub'' directory)

ftp> get my.file

transfer complete

ftp> quit

The standard transfer protocol is ASCII. This is suitable for text. Use the command binary if transferring program or image files. (Note: on VAX-VMS computers use IMAGE).

Large files are usually ``tared'' and compressed. You have to use binary FTP to get such files. The file extension shows how to uncompress it:

 
 .tar     		  tar -xvf  myfile.tar

.Z uncompress myfile.Z

.tar.Z uncompress myfile.tar.Z

tar -xvf myfile.tar



next up previous contents index
Next: rcp Up: ftp Previous: Usage Notes:



Alan Silverman
Wed Apr 12 16:54:02 METDST 1995