使用Winscp進行Linux到Windows的檔案同步

來源:互聯網
上載者:User

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計劃任務裡面

完成...

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.