WinSCPで自動でディレクトリの同期

2012年9月10日

WinSCPにはコマンドモードがありますが

このコマンドモードでスクリプトを少しだけ書いて実行してあげると

サーバのディレクトリとWindows上のフォルダの中身を自動で同期してくれる。

スクリプトというのは
[shell]option batch on
open bnavi@192.168.1.100
sync remote -filemask="| .svn/;*.log" -delete C:\Users\hogehoge\Documents\eclipse /home/hogehoge/product
keepuptodate -filemask="| .svn/;*.log" -delete C:\Users\hogehoge\Documents\eclipse /home/hogehoge/product
exit[/shell]
という感じで書きます。

このファイルを

WinSCPに食わしてやると、自動同期開始。
[shell]"C:\Program Files (x86)\WinSCP\WinSCP.com" /script="C:\Users\hogehoge\Documents\winscp-keepuptodate.txt"[/shell]

コマンドプロンプトを起動するのはめんどくさいので、ディスクトップにショートカットを作成してみます。

WinSCPのショートカットをまず作成します。

リンク先に、先ほどの実行コマンドを指定します。

WindowsWinSCP

Posted by GENDOSU