Brettb.Com
  HOME | ABOUT ME | BIOTECHNOLOGY | ARTICLES | GALLERY | CONTACT
Search: Go
TECHNICAL ARTICLES
 ASP
 ASP.NET
 JavaScript
 Transact SQL
 Other Articles
 Software Reviews

PHOTO GALLERIES
 Canon EOS 300D Samples
 Akihabara Maids!
 More Galleries...

TRAVEL LOG
 2009: China
 2008: Tokyo
 2007: Tokyo
 2006: Hong Kong
 2005: New York City

MORE STUFF
 Search Engine Optimisation
 Build an ASP Search Engine
 My Tropical Fishtank
 Autoglass
 SQL Month Name
 SQL Get Date Today
 SQL Year Month
 Other New Stuff...

POPULAR STUFF
 Regular Expressions
 Index Server & ASP
 JavaScript Ad Rotator

Home > Articles

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:

open ftp.servername.com
username
password

get default.asp
quit

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:

ftp -s:FTPcommands.txt

The FTP client will then execute the specified commands...

Demonstration of scripting the Windows FTP client

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.

  Site Map | Privacy Policy

All content is 1995 - 2012