I have been assisiting my client in troubleshooting an application problem that occurs daily. Technical support has required us to send them an updated log file each day. I wanted to set up a batch program that I could schedule to run daily that would execute the necessary FTP commands to send the file to them automatically.
I found the solution in this article onMS-DOS FTP command line arguments and commands. FTP has a -s switch which can be used like the > redirect to specify a command file to automate a series of FTP tasks. You can then use Windows Scheduler to execute FTP with the command line switch to read the series of commands from your command file.
- Save the series of FTP commands (one on each line) as a text file:
open [hostname] [username] [password] ascii put [filename] disconnect bye
- Create a batch file that executes FTP from the command line with the -s switch:
ftp -s:commands.txt
- Use Windows Task Scheduler to execute the above batch file at whatever interval is necesary