1.下載Winscp4.2.7並安裝,地址就不貼了,google一下應該很多.
2.安裝完畢後,先使用圖形化登陸一次,獲得Linux伺服器密鑰緩衝...[這一步不要遺漏],並儲存改設定.
3.編寫自動同步指令檔
# winscp.exe /console /script=sample.txt
# Automatically answer all prompts negatively not to stall
# the script on errors
# option echo on|off
option echo off
# option batch on|off|abort|continue
option batch on
# option confirm on|off
option confirm off
# option transfer binary|ascii|automatic
# option synchdelete on|off
# option exclude clear | <mask>[;<mask2>...]
# option include clear | <mask>[;<mask2>...]
# open [ sftp|ftp|scp:// ][ <user> [ :password ] @ ] <host> [ :<port> ]
# open user:password@example.com
# Connect FTP地址
open user:pwd@ip
# Change remote directory
# cd /home/user 轉到遠程目錄
cd /root
# Change local directory
# set to Self's working dir 設定需要同步到遠程FTP的本地檔案目錄
lcd E:\files
# Force binary mode transfer
option transfer binary
# Download file to the local directory d:\
# get examplefile.txt d:\
# option synchdelete on|off
option synchdelete off
# option include clear | <mask>[;<mask2>...]
# option include /2008-*-*/;/2009-*-*/;/2010-*-*/;/2011-*-*/;/2012-*-*/;/2013-*-*/
# synchronize local|remote|both [ <local directory> [ <remote directory> ] ] 從遠程同步到本地用Local;從本地同步到遠程用Remote
synchronize local
# Disconnect
close
# Exit WinSCP
exit
4.編寫bat檔案
"%winscp setupPath%\Winscp.exe" /console /script=同步指令檔絕對路徑
5.放到windows計劃任務裡面
完成...