Difficulties automating FTP transfers
Some developers think they need a third-party tool or some complex source code to do FTP. There is an easier way to do FTP with scripting windows scripting host. The FTP executable from Windows has a command line option for running scripts. You can schedule regular FTP scripts using Task Scheduler. (AT command)
You should make a text file for the script which can be used as parameter for the ftp command and and put your ftp command in it.
The script above would FTP to your.ftp.site.com and do a logon with username and password. Then it changes directory and gets some testfiles. You can run this script in visual basic Script like:
Set objShell = CreateObject("WScript.Shell")
objShell.Run "cmd /c c:\winnt\system32\ftp.exe -s:filename" >> " & FTPLogfile, 1, True
Set objShell = Nothing
The FTPLogfile is optional and can be used to do some logging. We use this for automating ftp.
About the Author
Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience, including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.