设为首页收藏本站

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 213|回复: 0

Using WinSCP Synchronization (general)

[复制链接]
发表于 2014-3-14 19:16:49 | 显示全部楼层 |阅读模式
本帖最后由 demo 于 2014-3-15 11:19 编辑

Directory Synchronization
This article contains detailed description of synchronizing files. You may want to see simplified guide to the process instead.
WinSCP can synchronize content of local directory with remote one or vice versa or even mutually. Find the function in Commands > Synchronize. Synchronize dialog will appear, where you can select synchronization mode and configure options.
Once you confirm your options, WinSCP will collect list of differences in between the directories. If option Preview changes is enabled, you will be presented with the synchronization checklist, where you can select those synchronization actions you want to actually apply.
You can select files and directories for synchronization the same way you select them for file transfer.
Before using the function make sure that WinSCP knows correct timestamps of remote files, to avoid losing data.
If you use WinSCP to synchronize your files only, you can use command-line parameter /synchronize to quickly open Synchronize dialog.

Synchronization Direction
There are three possible directions (targets) of synchronization.
With Local direction, changes from remote directory (source) are applied to local directory (target). Only the local directory is modified.
Remote mode is the same as Local, just in an opposite direction: changes from the local directory (source) are applied to the remote directory (target). Only the remote directory is modified.
In Both mode, both local and remote directories can be modified (both can act as both source and target).


Synchronization Mode
There are three modes of synchronization.
With Synchronize files mode, the newer files in source directory are transferred to the opposite directory. Files in source directory not present in target directory can optionally be transferred as well (disable this using the option Existing files only). Files in target directory not present in source directory are optionally deleted (enable option Delete files). In Both mode (see above), file not present in an opposite directory is considered new, hence it is transferred (if allowed), but never deleted. In other words, in Both mode, no file is ever deleted.
With Mirror files mode, the different (both newer and older) files in source directory are transferred to the opposite directory. Otherwise the mode is the same as Synchronize files.
With Synchronize timestamps mode, the timestamps of target files are updated to match timestamps of source files. It will not do any transfers, nor delete anything. Simply, whenever it finds the same file in both directories it updates the timestamp of target file to match the one of source file. In Both mode, it always updates the older timestamp. The mode is available with SFTP protocol only.

Automating Synchronization
  1. To automate synchronization use scripting command  or .NET assembly method
  2. Session.SynchronizeDirectories
复制代码
来自圈子: Demo俱乐部
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|BC Morning Website ( Best Deal Inc. 001 )  

GMT-8, 2026-2-5 15:50 , Processed in 0.013028 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表