This is an old revision of the document!

Session.SynchronizeDirectories Method

Synchronizes directories.

This feature will be available only with the next release.

Syntax

public SynchronizationResult SynchronizeDirectories(
    SynchronizationMode mode,
    string localPath,
    string remotePath,
    bool removeFiles,
    bool mirror = false,
    SynchronizationCriteria criteria = SynchronizationCriteria.Time,
    TransferOptions options = null
)

Advertisement

Parameters

Name Description
SynchronizationMode mode Synchronization mode. Possible values are SynchronizationMode.Local, SynchronizationMode.Remote and SynchronizationMode.Both.
string localPath Full path to local directory.
string remotePath Full path to remote directory.
bool removeFiles When set to true, deletes obsolete files. Cannot be used for SynchronizationMode.Both.
bool mirror When set to true, synchronizes in mirror mode (synchronizes also older files). Cannot be used for SynchronizationMode.Both. Defaults to false.
SynchronizationCriteria criteria Comparison criteria. Possible values are SynchronizationCriteria.None, SynchronizationCriteria.Time (default), SynchronizationCriteria.Size and SynchronizationCriteria.Either. For SynchronizationMode.Both SynchronizationCriteria.Time can be used only.
TransferOptions options Transfer options. Defaults to null, what is equivalent to new TransferOptions().

Return Value

SynchronizationResult. See also Capturing results of operations.

Exceptions

Exception Condition
InvalidOperationException Session is not opened.
ArgumentException
ArgumentOutOfRangeException
Invalid combination of values of TransferOptions properties, SynchronizationMode, mirror or SynchronizationCriteria.
SessionLocalException Error communicating with winscp.com.
See the exception documentation for details.
TimeoutException Timeout waiting for winscp.com to respond.

Advertisement

Remarks

Event Session.FileTransferred is raised for every uploaded or downloaded file.

Last modified: by martin