Differences

This shows you the differences between the selected revisions of the page.

scriptcommand_synchronize 2020-05-29 scriptcommand_synchronize 2024-04-25 (current)
Line 2: Line 2:
[[task_synchronize_full|Synchronizes]] content of a local directory with a remote one or vice versa or mutually. [[task_synchronize_full|Synchronizes]] content of a local directory with a remote one or vice versa or mutually.
-===== Syntax =====+===== [[syntax]] Syntax =====
  synchronize local|remote|both [ <local directory> [ <remote directory> ] ]   synchronize local|remote|both [ <local directory> [ <remote directory> ] ]
Line 19: Line 19:
| ''-==delete==''              | Delete obsolete files. Ignored for ''[[#both|both]]'' mode. | | ''-==delete==''              | Delete obsolete files. Ignored for ''[[#both|both]]'' mode. |
| ''-==mirror==''              | [[task_synchronize_full#mode|Mirror mode]] (synchronize also older files). Ignored for ''[[#both|both]]'' mode.  | | ''-==mirror==''              | [[task_synchronize_full#mode|Mirror mode]] (synchronize also older files). Ignored for ''[[#both|both]]'' mode.  |
-| ''-==criteria===<criteria>'' | [[ui_synchronize#criteria|Comparison criteria]]. Possible values are ''time'', ''size'', ''either'' and ''none''. Ignored for ''[[#both|both]]'' mode. | +| ''-==criteria===<criteria>'' | [[ui_synchronize#criteria|Comparison 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|both]]'' mode. | 
-| ''-==preservetime==''        | Preserve timestamp. Enforced by default unless ''[[#criteria|-criteria]]'' is ''size'' or ''none''. | +| ''-==preservetime==''        | Preserve timestamp. Enforced by default unless ''[[#criteria|-criteria]]'' lacks ''time''. | 
-| ''-==nopreservetime==''      | Do not preserve timestamp. Ignored unless ''[[#criteria|-criteria]]'' is ''size'' or ''none''. |+| ''-==nopreservetime==''      | Do not preserve timestamp. Ignored unless ''[[#criteria|-criteria]]'' lacks ''time''. |
| ''-==permissions===<mode>''  | Set permissions ([[SFTP]] and [[SCP]] protocols only). | | ''-==permissions===<mode>''  | Set permissions ([[SFTP]] and [[SCP]] protocols only). |
| ''-==nopermissions==''      | Keep default permissions. | | ''-==nopermissions==''      | Keep default permissions. |
Line 27: Line 27:
| ''-==transfer===<mode>''    | ''%%binary|ascii|automatic%%'' \\ [[transfer_mode|Transfer mode]]: binary, ascii (text), automatic (by extension). | | ''-==transfer===<mode>''    | ''%%binary|ascii|automatic%%'' \\ [[transfer_mode|Transfer mode]]: binary, ascii (text), automatic (by extension). |
| ''-==filemask===<mask>''    | ''%%<mask>[;<mask2>...]%%'' \\ Sets [[file_mask|file mask]]. | | ''-==filemask===<mask>''    | ''%%<mask>[;<mask2>...]%%'' \\ Sets [[file_mask|file mask]]. |
-| ''-==resumesupport===·<state>'' | ''%%on|off|<threshold>%%'' \\ Configures [[resume#automatic|automatic resume/transfer to temporary filename]]. | +| ''-==resumesupport===<state>'' | ''%%on|off|<threshold>%%'' \\ Configures [[resume#automatic|automatic resume/transfer to temporary filename]]. |
| ''-==rawtransfersettings== setting1=value1 setting2=value2 ...'' | Allows configuring any transfer settings using [[rawtransfersettings|raw format]] 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. | | ''-==rawtransfersettings== setting1=value1 setting2=value2 ...'' | Allows configuring any transfer settings using [[rawtransfersettings|raw format]] 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. |
-Effective [[scriptcommand_option|options]]: ''[[[[scriptcommand_option#reconnecttime|reconnecttime]]'', ''[[scriptcommand_option#failonnomatch|failonnomatch]]''+Effective [[scriptcommand_option|options]]: ''[[scriptcommand_option#reconnecttime|reconnecttime]]'', ''[[scriptcommand_option#failonnomatch|failonnomatch]]''
XML log elements: ''[[logging_xml#download|download]]'' (with ''[[#local|local]]'' or ''[[#both|both]]''), ''[[logging_xml#upload|upload]]'' (with ''[[#remote|remote]]'' or ''both''), ''[[logging_xml#mkdir|mkdir]]'', ''[[logging_xml#touch|touch]]'' (with ''remote'' or ''both''), ''[[logging_xml#chmod|chmod]]'' (with ''remote'' or ''both'' and ''[[#permissions|-permissions]]''), ''[[logging_xml#rm|rm]]'' (with ''remote'' and ''[[#delete|-delete]]'') XML log elements: ''[[logging_xml#download|download]]'' (with ''[[#local|local]]'' or ''[[#both|both]]''), ''[[logging_xml#upload|upload]]'' (with ''[[#remote|remote]]'' or ''both''), ''[[logging_xml#mkdir|mkdir]]'', ''[[logging_xml#touch|touch]]'' (with ''remote'' or ''both''), ''[[logging_xml#chmod|chmod]]'' (with ''remote'' or ''both'' and ''[[#permissions|-permissions]]''), ''[[logging_xml#rm|rm]]'' (with ''remote'' and ''[[#delete|-delete]]'')
Line 52: Line 52:
Switches mapping: Switches mapping:
^ Switch                  ^ Mapping ^ ^ Switch                  ^ Mapping ^
 +| ''-preview''            | Use [[library_session_comparedirectories|''Session.CompareDirectories'' method]] instead of ''Session.SynchronizeDirectories''. |
| ''-delete''              | Value ''true'' (''$True'' in PowerShell) for method parameter ''removeFiles''. | | ''-delete''              | Value ''true'' (''$True'' in PowerShell) for method parameter ''removeFiles''. |
| ''-mirror''              | Value ''true'' (''$True'') for method parameter ''mirror''. | | ''-mirror''              | Value ''true'' (''$True'') for method parameter ''mirror''. |
-| ''-criteria''            | Set method parameter ''criteria''. Use ''SynchronizationCriteria.Time'' for ''time'', ''SynchronizationCriteria.Size'' for ''size'', ''SynchronizationCriteria.Either'' for ''either'' and ''SynchronizationCriteria.None'' for ''none''. \\ [[library_powershell#enums|Enumeration syntax]] in PowerShell is like ''[WinSCP.SynchronizationCriteria]::Time''. |+| ''-criteria''            | Set method parameter ''criteria''. Use ''SynchronizationCriteria.Time'' for ''time'', ''SynchronizationCriteria.Size'' for ''size'', ''SynchronizationCriteria.Checksum'' for ''checksum'' and ''SynchronizationCriteria.None'' for ''none''. \\ [[library_powershell#enums|Enumeration syntax]] in PowerShell is like ''[WinSCP.SynchronizationCriteria]::Time''. |
| ''-permissions'' \\ ''-nopermissions'' \\  ''-transfer'' \\ ''-filemask'' \\ ''-resumesupport'' \\ ''-speed=<kbps>'' | [[library_from_script_transfer_settings|Converting transfer settings scripting switches]] to .NET assembly class ''TransferSettings''. | | ''-permissions'' \\ ''-nopermissions'' \\  ''-transfer'' \\ ''-filemask'' \\ ''-resumesupport'' \\ ''-speed=<kbps>'' | [[library_from_script_transfer_settings|Converting transfer settings scripting switches]] to .NET assembly class ''TransferSettings''. |

Last modified: by martin