Recently while re-jigging my web servers I needed a new solution to automate the transferring of files from one server to another.
I decided to use the built in “Scheduled Tasks” Applet of Windows Server 2003 and the FTP command prompt also built into the same OS. However all was not as simple as I had first figured. the FTP client would simply hang without error nor reason.
Instead of banging my head against the wall any longer I decided to whip together a home brew command line ftp client, while it is limited to only “GET” files it has some nifty features.
This little (75k) application is perfect for fetching mySQL dump files for remote Database Backups, downloading web server log files or any other file that you might want.
Here is an example command line:
ftpcmd.exe -h [host.com] -u [username] -p [password] -i htdocs -r [remote filename] -o -s -d -m $DATE$
Explanation:
Connect to “host.com” using “username” & “password”, change directory to htdocs create a local directory based on todays date and then download the “remote file” to the just created directory. The “-o” switch tells the client to overwrite the local file if it already exists. “-s” switches the client to passive mode. “-d” deletes the remote file after “getting”.
A full list of switches can be found by simply double clicking the exe file after unziping.
Download Here
http://www.jasonwhite.co.uk/wp-content/uploads/2006/07/ftpcmd.zip
I hope it helps you as much as it has helped me. If you have any comments or feature requests I would be very happy to hear them.
.J
Here allow me!
(To leave your first comment)
I was wondering, which language you used to write it; VB or Delphi?
Hi Roo,
Good to see ya
it is written in Delphi, why do you ask?
Jay
Because I wrote one in delphi a couple of years ago, except mine was gui, with form to fill in connection params, saved to an encrypted ini file, to hide them from users for security, it was to a proprieary site. I think command line is good idea, particularly for running from a server, for off-site backup, for example.
I think I used ftp component from Async-Pro (once Turbo-Power, since donated to Source-Forge)