qftp is a simple program which demonstrates the use of ftplib.

qftp performs directories or file transfers using the ftp protocol based
on the command it was invoked with and command line arguments.  qftp
should be invoked through a softlink which indicates which operation it
should perform.

To install, copy qftp to a directory in your path.  Execute the following
commands in that directory:

	ln -s qftp ftpdir
	ln -s qftp ftpget
	ln -s qftp ftpsend
	ln -s qftp ftprm
	ln -s qftp ftplist

Then, invoke qftp by using the commands ftpdir, ftpget, ftpsend, ftprm or
ftplist.

qftp processes the command line in order.  The first argument should be
the name of the system you wish to converse with.  If you need to specify
login information, that should be specified next with '-l' and '-p'.  On
UNIX systems, if you specify a username with '-l' and don't specify a
password with '-p', qftp will prompt for a password.  It is a good idea
to do it this way as it keeps the password off the command line and out
of 'ps' and other displays.

When working through a proxy firewall, specify the firewall machine's
name as the host.  Specify the real host's name with the -l and -p
parameters.  For example:

	ftpget firewall -l anonymous@real.host.com -p user@myhost.org

The exit status from qftp can be used to determine whether the transfer
worked or not.  Exit status 2 means a command line syntax error.  3
indicates a failure while attempting to translate the system name into an
IP address.  4 indicates a failure attempting to connect to the remote
machine.  5 indicates a login failure.  6 indicates a remote command
error.  7 indicates a system call error.

The command format is as follows:

	<xxx> host [ -l user [ -p pass ] ]
		   [ [ -v level ]
		     [ -m umask ]
		     [ -r path ]
		     [ -a | -i ]
		     [ file ]
		   ] ...

<xxx> should be replaced with 'ftpget', 'ftpdir', 'ftpsend', 'ftprm' or
'ftplist'.  'host' is the name of the remote server machine and should
immediately follow the command.

'-l user' specifies the username to login with.  '-p pass' specifies the
password to use with that username.  These should be specified
immediately after the hostname.  On UNIX systems, if a username is
specified but a password is not, qftp will prompt for a password.  If
neither is specified, an anonymous login is attempted.

'-v level' can be used to set the logging level of the routines.  This
can appear anywhere on the command line and will affect the logging of
any actions performed on later command line arguments.  Non-zero
values cause qftp to log the actions it performs and display progress.
Values greater than 1 cause ftplib to display responses received from
the server.  Values greater than 2 cause ftplib to display commands
sent to the server.

'-r path' can be used to change to a different directory on the server.
'-m umask' attempts to change the default permissions mask on the server
by issuing a 'SITE umask' command.  This will not work with all servers
but should work with almost any unix based server.

'-a' and '-i' set ASCII and Image mode, respectively.  This will apply to
all files transfered until another '-a' or '-i' is encountered on the
command line.

'file' specifies the name of a file to transfer.  The specified file name
will be used on both the local machine and the server.  If no files are
specified for 'ftpget' or 'ftpsend', a list of file names will be read
from stdin.

Examples

I use ftpsend to upload my web pages to my ISP.  I maintain them all on
my home PC under linux and send either the entire directory tree or just
modified files with ftpsend.

To send the entire directory tree, I execute the following command from
my login directory:

	find public_html -print | ftpsend cnj -l pfau -m 022

(connect to system cnj, login as user pfau and prompt for a password, set
the umask to 022, send files whose names will be read from standard input
which is generated by the 'find' command which lists all files under my
public_html directory)

If I modify a file or two, I'll send them from my html directory with the
following command:

	ftpsend cnj -l pfau -m 022 -r public_html index.html hot.html

(connect to system cnj, login as user pfau and prompt for a password, set
the umask to 022, change directory to public_html, send files index.html
and hot.html)

To grab the latest directory listing of the linux area off of sunsite:

	ftpget sunsite.unc.edu -r /pub/Linux ls-lR.gz

(connect to system sunsite.unc.edu, use an anonymous login, switch to
directory /pub/Linux, get file ls-lR.gz)
