Transact SQL Other Articles Software Reviews
Scripting the Windows FTP Client
Here's a demonstration of how to script the Windows console based FTP client utility. This technique is useful if you want to set up a batch script to send or retrieve files to a remote server. Furthermore the technique requires no programming language other than writing a simple DOS batch script.
Few people know that the Windows FTP command has a -s parameter that allows you to specify a filename containing a list of commands that the FTP command should use.
So to FTP a file called default.asp from a remote server called ftp.servername.com, you would create a text file containing the following:
Note that username and password should be replaced with the username and password of an account which has appropriate access rights to send or retrieve the required files.
Once the file has been saved (in this example it has been saved as FTPcommands.txt, it can be called from the Windows command line or in a batch file using the following:
The FTP client will then execute the specified commands...
Don't forget that a full list of FTP commands available is in the Windows Help File (available from the Help button on the Windows Start menu). Look for ftp commands, overview or ftp commands, subcommands in the help index.