Download the portable version of WinSCP and extract it to the hard drive.
Create a file in the WinSCP folder called sync.txt with the following contents:
1 2 3 4 5 6 |
option batch on option confirm off open ftp://username:password@host synchronize remote c:\usr\media /images -delete -mirror close exit |
This will place the images from the local folder c:\usr\media in a folder named images under the FTP user’s home account.
Create a file in the WinSCP folder called sync.bat with the following contents:
1 |
winscp.com /script=sync.txt |
Test your settings by running this batch file. This should open a command line window and run the synchronization. Verify that the images have appeared on the FTP server.
If desired, you could add this synchronization as a scheduled task in Windows.
Run synchronization invisibly
It is possible to run the batch file without opening a command line window. This is especially useful when you’ve scheduled to run the file every few minutes or hours and don’t want it to pop up everytime.
Create a file in the WinSCP folder called sync.vbs with the following contents:
1 2 3 |
Set WshShell = CreateObject("WScript.Shell") WshShell.Run chr(34) & "c:\winscp\sync.bat" & Chr(34), 0 Set WshShell = Nothing |
Make sure the path to sync.bat matches the actual folder structure on your hard drive.
You can now use this VBS file instead of the batch file to run the synchronization and it will hide the command line window.