Differences
This shows you the differences between the selected revisions of the page.
task_synchronize_full 2006-07-25 | task_synchronize_full 2022-11-12 (current) | ||
Line 1: | Line 1: | ||
====== Directory Synchronization ====== | ====== Directory Synchronization ====== | ||
+ | //This article contains detailed description of synchronizing files. You may want to see [[guide_synchronize|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//. [[ui_synchronize|Synchronize dialog]] will appear, where you can select synchronization mode and configure options. | WinSCP can synchronize content of local directory with remote one or vice versa or even mutually. Find the function in //Commands > Synchronize//. [[ui_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 [[ui_synchronize_checklist|synchronization checklist]], where you can select those synchronization actions you want to actually apply. | 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 [[ui_synchronize_checklist|synchronization checklist]], where you can select those synchronization actions you want to actually apply. | ||
- | Files and directories [[ui_transfer#other_options|excluded from transfer]] are excluded from synchronization too. | + | You can select files and directories for synchronization the same way you [[ui_transfer_custom#other|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 ''[[commandline#operations|/synchronize]]'' to quickly open [[ui_synchronize|Synchronize dialog]]. | ||
+ | |||
+ | ===== [[direction]] 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. | ||
- | Before using the function make sure that WinSCP knows correct timestamps of remote files, to avoid losing data. | + | //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. |
- | If you use WinSCP to synchronize your files only, you can use [[commandline|command-line parameter]] ''/synchronize'' to quickly open [[ui_synchronize|Synchronize dialog]]. | + | In //Both// mode, both local and remote directories can be modified (both can act as both source and target). |
- | ===== Synchronization Modes ===== | + | ===== [[mode]] Synchronization Mode ===== |
- | There are three direction modes for synchronization. | + | There are three modes of synchronization. |
- | In //Local// mode, changes from remote directory are applied to local directory. Only the local directory is modified. If a file in the remote directory is newer than the same file in local directory, the local file is updated. Remote files not in the local directory can optionally be downloaded as well (disable this using the option //Existing files only//). The local files not existing in remote directory are optionally deleted (enable option //Delete files//). | + | With //Synchronize files// mode, files that are newer in a source directory than in a target directory are transferred to the target directory. Files in the source directory not present in the target directory are by default transferred as well (disable this using the option //Existing files only//). Files in the target directory not present in the source directory can optionally be deleted (enable option //Delete files//). In //Both// mode (see above), files not present in an opposite directory are considered new, hence they are transferred (unless //Existing files only// is enabled), but never deleted. In other words, in //Both// mode, no file is ever deleted. |
- | //Remote// mode is the same as //Local//, just in the opposite direction: changes from the local directory are applied to the remote directory. Only the remote directory is modified. | + | With //Mirror files// mode, different (both newer and older) files in the source directory are transferred to the target directory. Otherwise the mode is the same as //Synchronize files//. |
- | In //Both// mode, both local and remote directories can be modified. The newer files are transferred to the opposite directory. The files not existing in an opposite directory are optionally transferred too (disable this using option //Existing files only//). In other words, no files are deleted. | + | With //Synchronize timestamps// mode, 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 a timestamp of a target file to match the one of a source file. In //Both// mode, it always updates the older timestamp. The mode is available with [[sftp|SFTP protocol]] only. |
===== Automating Synchronization ===== | ===== Automating Synchronization ===== | ||
- | To automate synchronization use [[scripting]] command ''synchronize''. | + | To automate synchronization use scripting command ''[[scriptcommand_synchronize|synchronize]]'' or .NET assembly method ''[[library_session_synchronizedirectories|Session.SynchronizeDirectories]]''. |