Menu  Toggle search  [ ![](https://winscp-
static-746341.c.cdn77.org/assets/images/logos/logo.png?v=7032) WinSCP  Free
SFTP, SCP, S3 and FTP client  for  Windows  ](https://winscp.net/)

  * [ Home ](/eng/index.php)
  * [ News ](/eng/news.php)
  * [ Introduction ](/eng/docs/introduction)
  * [ Download ](/eng/download.php)
  * [ Install ](/eng/docs/guide_install)
  * [ Documentation ](/eng/docs/)
  * [ Forum ](/forum/)

Close

Search

Close

[ Documentation ](/eng/docs/start "Documentation") » [ Features
](/eng/docs/feature_index "Features") » [ Scripting ](/eng/docs/scripting
"Scripting") » [ Script Commands ](/eng/docs/scripting#commands "Script
Commands") »

#  synchronize command

[ Synchronizes ](/eng/docs/task_synchronize_full) content of a local directory
with a remote one or vice versa or mutually.

  * Syntax 
  * Remarks 
  * Examples 
  * Converting to .NET Assembly 

_Advertisement_

##  Syntax

    
    
    synchronize local|remote|both [ <local directory> [ <remote directory> ] ]
    

##  Remarks

When the first parameter is ` local ` , changes from remote directory are
applied to local directory. When the first parameter is ` remote  ` , changes
from the local directory are applied to the remote directory. When the first
parameter is ` both  ` , both local and remote directories can be modified.

When directories are not specified, current working directories are
synchronized.

Note: Overwrite confirmations are always off for the command.

Switches:

Switch  |  Description   
---|---  
` -preview ` |  Preview changes only, do not synchronize. Transfer settings switches ` -permissions  ` , ` -nopermissions  ` , ` -speed  ` , ` -transfer  ` and ` -resumesupport  ` have no effect.   
` -delete ` |  Delete obsolete files. Ignored for ` both  ` mode.   
` -mirror ` |  [ Mirror mode ](/eng/docs/task_synchronize_full#mode) (synchronize also older files). Ignored for ` both  ` mode.   
` -criteria=<criteria> ` |  [ Comparison criteria ](/eng/docs/ui_synchronize#criteria) . A comma-separated list of any of ` time ` , ` size ` and ` checksum ` , or ` none ` . For backward compatibility, ` either ` is an alias to ` time,size ` . Ignored for ` both  ` mode.   
` -preservetime ` |  Preserve timestamp. Enforced by default unless ` -criteria  ` lacks ` time ` .   
` -nopreservetime ` |  Do not preserve timestamp. Ignored unless ` -criteria  ` lacks ` time ` .   
` -permissions=<mode> ` |  Set permissions ( [ SFTP ](/eng/docs/sftp) and [ SCP ](/eng/docs/scp) protocols only).   
` -nopermissions ` |  Keep default permissions.   
` -speed=<kbps> ` |  Limit transfer speed (in KB/s).   
` -transfer=<mode> ` |  ` binary|ascii|automatic `   
[ Transfer mode ](/eng/docs/transfer_mode) : binary, ascii (text), automatic
(by extension).  
` -filemask=<mask> ` |  ` <mask>[;<mask2>...] `   
Sets [ file mask ](/eng/docs/file_mask) .  
` -resumesupport=<state> ` |  ` on|off|<threshold> `   
Configures [ automatic resume/transfer to temporary filename
](/eng/docs/resume#automatic) .  
` -rawtransfersettings  setting1=value1  setting2=value2  …  ` |  Allows configuring any transfer settings using [ raw format ](/eng/docs/rawtransfersettings) as in an INI file. E.g. to enable preserving of directory timestamps, use ` -rawtransfersettings  PreserveTimeDirs=1  ` . The switch should come only after other parameters.   
  
_Advertisement_

Effective [ options ](/eng/docs/scriptcommand_option) : ` [ reconnecttime
](/eng/docs/scriptcommand_option#reconnecttime) ` , ` [ failonnomatch
](/eng/docs/scriptcommand_option#failonnomatch) `

XML  log elements: ` [ download ](/eng/docs/logging_xml#download) ` (with `
local  ` or ` both  ` ), ` [ upload ](/eng/docs/logging_xml#upload) ` (with `
remote  ` or ` both ` ), ` [ mkdir ](/eng/docs/logging_xml#mkdir) ` , ` [
touch ](/eng/docs/logging_xml#touch) ` (with ` remote ` or ` both ` ), ` [
chmod ](/eng/docs/logging_xml#chmod) ` (with ` remote ` or ` both ` and `
-permissions  ` ), ` [ rm ](/eng/docs/logging_