Translations of this page:
- 日本語 (ja)
- English (en)
最近の更新
最近の更新
How to synchronize a remote folder using WinSCP on Windows.
In this case, we'll connect using key authentication, with everything stored in the `Desktop\Sync` folder.
Desktop\Sync sync.bat upload.txt key.ppk
Synchronize the local folder `C:\Users\hogehoge\` with the remote folder `sync`.
※ If the path contains Japanese characters, the encoding of `upload.bat` must be Shift-JIS to avoid errors.
upload.bat
@rem sync set LOCAL="C:\Users\hogehoge\" set REMOTE="sync" set SESSION="sftp://matsui@hogehoge.com" "C:\Program Files (x86)\WinSCP\winscp.exe" /script=upload.txt /parameter %SESSION% %LOCAL% %REMOTE% /console /log=upload.log /privatekey=key.ppk
※ The `-delete` option deletes files on the remote side that do not exist locally.
upload.txt
option exclude "./03_App/Atom/; ./02_Photos/; */_old/; ./99_*/" open %1% lcd %2% cd %3% synchronize remote -delete -criteria=time exit
※ To exclude folders, list them in `option exclude` (use `;` to separate multiple paths)