Does this site look plain?

This site uses advanced css techniques

We've long used the wget to fetch data from a remote web or ftp server, but for customer projects we've needed to do the opposite: send a file to a remote FTP server. In the past we've done it either piping a response file to FTP or building a front end with Expect. Neither of this is really the right answer, as they don't handle error conditions terribly well.

Having done this one too many times and gotten sick of it, we decided to write a perl program that talks to the remote server directly using the Net::FTP module. This made the whole thing easy and reliable. The program is not very large at all - just a front end for the real workhorse provided by Net::FTP.


This program takes a handful of options (with only --server being required), plus a list of files to send to the other end. The options can be in any order, and at least one filename is required (it won't read from the standard input).

$ ftpput --verbose --user=steve --pass=yahright file1 file2
--> put file1
    (sent OK)
--> put file2
    (sent OK)
Show a brief help listing to the standard error and exit.
Enable Net::FTP package debugging. This is quite verbose and the output format is not always very helpful. For everyday use, try --verbose instead.
Print the name of each file being transferred. This isk much less "noisy" than --debug.
Connect to the FTP server SVR. This can be a hostname or an IP address. This parameter is required.
Login as the user U, or use anonymous if not given.
Provide password PASS to the FTP server during login. This defaults to "-anonymous@" if not given, but this is not very meaningful if this is not an anonymous connection. Sorry that this password is provided in cleartext on the command line: this has been entirely suitable for all of our applications.
Change to directory DIR on the remote system before sending any files. All the files provided on the command line have only the final part of the pathname considered - the directory path of the source files are not considered in any way.
Use passive FTP mode instead of active. This may be required by an Internet firewall in between your station and the remote FTP server.
Send the file in ASCII mode, which attempts to convert the local line termination (CR/LF, newline, CR) to that used by the remote server. This is only useful for text files.
Use binary ("image") mode when sending the file to the remote system. This performs no conversions of any kind on the data.
Print a hash mark (#) every 1024 bytes during the transfer to show progress.



Revision History