Wednesday, April 1, 2009

Small Batch file to transfer files over FTP

I was going through some old archived files and thought this one might be useful. This small script will transfer files over ftp from a batch file.

First create a file called ftpget.bat and copy the following lines into the file

ftp -s:get.txt
Next create a second file called get.txt. The name doesnt matter just make sure the name is the same name as the file in the above command.

Copy the following (change as needed) into the get.txt file

cd /folder/with/the/the/files
lcd c:\folder\where\you\want\the\files\to\go
mget *
You obvoiusly need to adjust the to point to an actual ftp server as well as adjust the username and password items.

***Please note that this really is not secure in any way as FTP is not secure to begin with but also the ftp username and password are stored in the text file.

You can then schedule the ftpget.bat file in windows scheduler or any other for that matter. Just make sure both files are in the same folder.

No comments: