Sunday, March 18, 2012

Automated FTP Synchronize with winscp



Platform: Windows server 2003

I have searched the solution to do a File Synchronize for a long time.
There are not many choices if looking for a free for business use software.

Finally, I  look into winscp.
I downloaded the portable version. It works well for me.



Now, I will tell you what I did to complete the task - FTP Synchronize & scheduled it


1) download winscp (I choose the portable version, click "winscp" to download page)

2) write operation script into .txt as the following:

For Example :

File Name: winscp_script.txt
--------------------------------------------------------------------------------
# errors without confirm
option batch on
option confirm off


# Connect
open ftp://[domain name / ip]

# binary mode transfer
option transfer binary

synchronize local E:\[
Local Folder] /[Remote Folder]

# Exit
exit

--------------------------------------------------------------------------------

Explanation :
     - replace [domain name / ip] by the remote host IP or domain name
     - replace [Local Folder] by the Target folder in your local disk
     - replace [Remote Folder] by the source folder in the FTP folder, if the folder isn't in the root folder
       ( just leave / if the source folder is the root folder. )

3) Add a new schedule task in windows.

Run Field:
c:\[winscp location]\WinSCP.exe /console /script=c:\[script location]\winscp\WinscpScriptFile.txt /log=c:\[log file  location]\log_WinscpScriptFile.txt




Explanation :
make it simple
to open winscp with the following parameter, and schedule this command in specified date/time
winscp.exe /console /script=[location] /log=[location]


just 3 steps, very Simple, right?


1 comment: