First create a windows bat file conatining something like the following;
@echo off
REM THIS IS A COMMENT AND WILL NOT RUN
REM AUTO FTP SCRIPT
REM ANTHONY BLAKE 11/09/2010
REM myftpurl.com COULD ALSO BE THE IP OF THE FTP SITE
ftp -s:"c:\SCRIPTS\ftpAuto.txt" myftpurl.com
REM DONE!
exit
Then create your ftpAuto.txt;
myUserName
myPassword
bin
cd /DestFolder
put c:\OutboundFiles\UploadFile.csv
bye
The bat file calls the Windows FTP command and tells it to use the ftpAuto.txt script. The script changes the remote folder on the ftp site to "DestFolder" and puts the local file UploadFile.csv onto the server.
Setup a Windows Scheduled task to run at a desired interval which runs the bat file.
Showing posts with label ftp. Show all posts
Showing posts with label ftp. Show all posts
Monday, 11 October 2010
Thursday, 7 October 2010
Useful Windows Batch File Commands
The following code checks if a directory exists, if not it is created. It then
moves a file into that directory.
This is ideal code to run before an ftp script as it will prevent a half written file being transmitted via FTP.
The pause command lets you see the results of the script. Remove it if automated on a Windows Scheduled Task.
This is ideal code to run before an ftp script as it will prevent a half written file being transmitted via FTP.
@echo off
if not exist "C:\Folder\Destination"
(
md "C:\Folder\Destination"
)
move "C:\Folder\Source\*.*"
"C:\Folder\Destination"
pause
The pause command lets you see the results of the script. Remove it if automated on a Windows Scheduled Task.
Subscribe to:
Posts (Atom)