1. 程式人生 > >使用Winscp從windows自動複製檔案到linux伺服器

使用Winscp從windows自動複製檔案到linux伺服器

之所以有這篇文章,是看到dreadhead的高效開發的敲門磚之後的一點點實踐,對應的是《Productive Programmer》這本書中Automation相關章節。

下面的這個小例子主要使用了Winscp的指令碼和命令列方式功能,更復雜的同步功能請使用 synchronize 命令。

命令:"c:\Program Files\WinSCP\WinSCP.exe" /console /script=c:\sync.txt

c:\sync.txt的內容

option confirm off

open user:pwd@host1
put c:\test.txt /root/tmp
close

open user:pwd@host2
put c:\test.txt /root/tmp
close

open user:pwd@host3
synchronize remote c:\tmp /root/tmp -delete
close

exit