ASPAlliance.com : The #1 Active Server Pages .NET Community The #1 ASP.NET Community
Search   Search

Subscribe   Subscribe

Powered by ORCSWeb Hosting


Site Stats


Powered By ASP.NET
 
Featured Sponsor

Featured Columnist


Featured Book
Microsoft ASP.NET Step by Step
Microsoft ASP.NET Step by Step

Find Prices


New! asp.netPRO

We publish our articles in the standard RSS format.

Powerful .NET Email Component

Code Sharing Software

ASP Kitchen: Miscellaneous Articles: Scripting the Windows FTP Client

Scripting the Windows FTP Client

Although not strictly related to ASP or ASP.NET, 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.

Further reading

Author details

Brett Burridge spent two years working in the University of Essex Computing Service, before moving to The Internet Applications Group in the Autumn of 1999, where he developed e-Business applications for a range of corporate clients and dot-com start ups.

Brett is presently employed as an Internet developer and technical writer through his own company, Winnersh Triangle Web Solutions Limited. The company produces a number of innovative products, including the popular ASP Documentation Tool, Index Server Companion, .NET Documentation Tool and SQL Documentation Tool.

As well as the ASPAlliance, Brett has written articles for Ariadne.ac.uk and ASPToday.

Contact Brett by emailing

Index Server Companion - allows Index Server to index content from remote websites and ODBC databases!!!

Article history

"Scripting the Windows FTP Client" published on ASPAlliance.com on 20 February 2002.

ASP Kitchen: Miscellaneous Articles: Scripting the Windows FTP Client

 Copyright © 2000-2003 ASPAlliance.com  Page Rendered at 7/23/2008 7:46:06 PM