github.com/artpar/rclone@v1.67.3/docs/content/commands/rclone_sync.md (about)

     1  ---
     2  title: "rclone sync"
     3  description: "Make source and dest identical, modifying destination only."
     4  slug: rclone_sync
     5  url: /commands/rclone_sync/
     6  groups: Sync,Copy,Filter,Listing,Important
     7  # autogenerated - DO NOT EDIT, instead edit the source code in cmd/sync/ and as part of making a release run "make commanddocs"
     8  ---
     9  # rclone sync
    10  
    11  Make source and dest identical, modifying destination only.
    12  
    13  ## Synopsis
    14  
    15  
    16  Sync the source to the destination, changing the destination
    17  only.  Doesn't transfer files that are identical on source and
    18  destination, testing by size and modification time or MD5SUM.
    19  Destination is updated to match source, including deleting files
    20  if necessary (except duplicate objects, see below). If you don't
    21  want to delete files from destination, use the
    22  [copy](/commands/rclone_copy/) command instead.
    23  
    24  **Important**: Since this can cause data loss, test first with the
    25  `--dry-run` or the `--interactive`/`-i` flag.
    26  
    27      rclone sync --interactive SOURCE remote:DESTINATION
    28  
    29  Note that files in the destination won't be deleted if there were any
    30  errors at any point.  Duplicate objects (files with the same name, on
    31  those providers that support it) are also not yet handled.
    32  
    33  It is always the contents of the directory that is synced, not the
    34  directory itself. So when source:path is a directory, it's the contents of
    35  source:path that are copied, not the directory name and contents.  See
    36  extended explanation in the [copy](/commands/rclone_copy/) command if unsure.
    37  
    38  If dest:path doesn't exist, it is created and the source:path contents
    39  go there.
    40  
    41  It is not possible to sync overlapping remotes. However, you may exclude
    42  the destination from the sync with a filter rule or by putting an 
    43  exclude-if-present file inside the destination directory and sync to a
    44  destination that is inside the source directory.
    45  
    46  Rclone will sync the modification times of files and directories if
    47  the backend supports it. If metadata syncing is required then use the
    48  `--metadata` flag.
    49  
    50  Note that the modification time and metadata for the root directory
    51  will **not** be synced. See https://github.com/artpar/artpar/issues/7652
    52  for more info.
    53  
    54  **Note**: Use the `-P`/`--progress` flag to view real-time transfer statistics
    55  
    56  **Note**: Use the `rclone dedupe` command to deal with "Duplicate object/directory found in source/destination - ignoring" errors.
    57  See [this forum post](https://forum.rclone.org/t/sync-not-clearing-duplicates/14372) for more info.
    58  
    59  # Logger Flags
    60  
    61  The `--differ`, `--missing-on-dst`, `--missing-on-src`, `--match` and `--error` flags write paths, one per line, to the file name (or
    62  stdout if it is `-`) supplied. What they write is described in the
    63  help below. For example `--differ` will write all paths which are
    64  present on both the source and destination but different.
    65  
    66  The `--combined` flag will write a file (or stdout) which contains all
    67  file paths with a symbol and then a space and then the path to tell
    68  you what happened to it. These are reminiscent of diff files.
    69  
    70  - `= path` means path was found in source and destination and was identical
    71  - `- path` means path was missing on the source, so only in the destination
    72  - `+ path` means path was missing on the destination, so only in the source
    73  - `* path` means path was present in source and destination but different.
    74  - `! path` means there was an error reading or hashing the source or dest.
    75  
    76  The `--dest-after` flag writes a list file using the same format flags
    77  as [`lsf`](/commands/rclone_lsf/#synopsis) (including [customizable options
    78  for hash, modtime, etc.](/commands/rclone_lsf/#synopsis))
    79  Conceptually it is similar to rsync's `--itemize-changes`, but not identical
    80  -- it should output an accurate list of what will be on the destination
    81  after the sync.
    82  
    83  Note that these logger flags have a few limitations, and certain scenarios
    84  are not currently supported:
    85  
    86  - `--max-duration` / `CutoffModeHard`
    87  - `--compare-dest` / `--copy-dest`
    88  - server-side moves of an entire dir at once
    89  - High-level retries, because there would be duplicates (use `--retries 1` to disable)
    90  - Possibly some unusual error scenarios
    91  
    92  Note also that each file is logged during the sync, as opposed to after, so it
    93  is most useful as a predictor of what SHOULD happen to each file
    94  (which may or may not match what actually DID.)
    95  
    96  
    97  ```
    98  rclone sync source:path dest:path [flags]
    99  ```
   100  
   101  ## Options
   102  
   103  ```
   104        --absolute                Put a leading / in front of path names
   105        --combined string         Make a combined report of changes to this file
   106        --create-empty-src-dirs   Create empty source dirs on destination after sync
   107        --csv                     Output in CSV format
   108        --dest-after string       Report all files that exist on the dest post-sync
   109        --differ string           Report all non-matching files to this file
   110    -d, --dir-slash               Append a slash to directory names (default true)
   111        --dirs-only               Only list directories
   112        --error string            Report all files with errors (hashing or reading) to this file
   113        --files-only              Only list files (default true)
   114    -F, --format string           Output format - see lsf help for details (default "p")
   115        --hash h                  Use this hash when h is used in the format MD5|SHA-1|DropboxHash (default "md5")
   116    -h, --help                    help for sync
   117        --match string            Report all matching files to this file
   118        --missing-on-dst string   Report all files missing from the destination to this file
   119        --missing-on-src string   Report all files missing from the source to this file
   120    -s, --separator string        Separator for the items in the format (default ";")
   121    -t, --timeformat string       Specify a custom time format, or 'max' for max precision supported by remote (default: 2006-01-02 15:04:05)
   122  ```
   123  
   124  
   125  ## Copy Options
   126  
   127  Flags for anything which can Copy a file.
   128  
   129  ```
   130        --check-first                                 Do all the checks before starting transfers
   131    -c, --checksum                                    Check for changes with size & checksum (if available, or fallback to size only).
   132        --compare-dest stringArray                    Include additional comma separated server-side paths during comparison
   133        --copy-dest stringArray                       Implies --compare-dest but also copies files from paths into destination
   134        --cutoff-mode HARD|SOFT|CAUTIOUS              Mode to stop transfers when reaching the max transfer limit HARD|SOFT|CAUTIOUS (default HARD)
   135        --ignore-case-sync                            Ignore case when synchronizing
   136        --ignore-checksum                             Skip post copy check of checksums
   137        --ignore-existing                             Skip all files that exist on destination
   138        --ignore-size                                 Ignore size when skipping use modtime or checksum
   139    -I, --ignore-times                                Don't skip items that match size and time - transfer all unconditionally
   140        --immutable                                   Do not modify files, fail if existing files have been modified
   141        --inplace                                     Download directly to destination file instead of atomic download to temp/rename
   142        --max-backlog int                             Maximum number of objects in sync or check backlog (default 10000)
   143        --max-duration Duration                       Maximum duration rclone will transfer data for (default 0s)
   144        --max-transfer SizeSuffix                     Maximum size of data to transfer (default off)
   145    -M, --metadata                                    If set, preserve metadata when copying objects
   146        --modify-window Duration                      Max time diff to be considered the same (default 1ns)
   147        --multi-thread-chunk-size SizeSuffix          Chunk size for multi-thread downloads / uploads, if not set by filesystem (default 64Mi)
   148        --multi-thread-cutoff SizeSuffix              Use multi-thread downloads for files above this size (default 256Mi)
   149        --multi-thread-streams int                    Number of streams to use for multi-thread downloads (default 4)
   150        --multi-thread-write-buffer-size SizeSuffix   In memory buffer size for writing when in multi-thread mode (default 128Ki)
   151        --no-check-dest                               Don't check the destination, copy regardless
   152        --no-traverse                                 Don't traverse destination file system on copy
   153        --no-update-dir-modtime                       Don't update directory modification times
   154        --no-update-modtime                           Don't update destination modtime if files identical
   155        --order-by string                             Instructions on how to order the transfers, e.g. 'size,descending'
   156        --partial-suffix string                       Add partial-suffix to temporary file name when --inplace is not used (default ".partial")
   157        --refresh-times                               Refresh the modtime of remote files
   158        --server-side-across-configs                  Allow server-side operations (e.g. copy) to work across different configs
   159        --size-only                                   Skip based on size only, not modtime or checksum
   160        --streaming-upload-cutoff SizeSuffix          Cutoff for switching to chunked upload if file size is unknown, upload starts after reaching cutoff or when file ends (default 100Ki)
   161    -u, --update                                      Skip files that are newer on the destination
   162  ```
   163  
   164  ## Sync Options
   165  
   166  Flags just used for `rclone sync`.
   167  
   168  ```
   169        --backup-dir string               Make backups into hierarchy based in DIR
   170        --delete-after                    When synchronizing, delete files on destination after transferring (default)
   171        --delete-before                   When synchronizing, delete files on destination before transferring
   172        --delete-during                   When synchronizing, delete files during transfer
   173        --fix-case                        Force rename of case insensitive dest to match source
   174        --ignore-errors                   Delete even if there are I/O errors
   175        --max-delete int                  When synchronizing, limit the number of deletes (default -1)
   176        --max-delete-size SizeSuffix      When synchronizing, limit the total size of deletes (default off)
   177        --suffix string                   Suffix to add to changed files
   178        --suffix-keep-extension           Preserve the extension when using --suffix
   179        --track-renames                   When synchronizing, track file renames and do a server-side move if possible
   180        --track-renames-strategy string   Strategies to use when synchronizing using track-renames hash|modtime|leaf (default "hash")
   181  ```
   182  
   183  ## Important Options
   184  
   185  Important flags useful for most commands.
   186  
   187  ```
   188    -n, --dry-run         Do a trial run with no permanent changes
   189    -i, --interactive     Enable interactive mode
   190    -v, --verbose count   Print lots more stuff (repeat for more)
   191  ```
   192  
   193  ## Filter Options
   194  
   195  Flags for filtering directory listings.
   196  
   197  ```
   198        --delete-excluded                     Delete files on dest excluded from sync
   199        --exclude stringArray                 Exclude files matching pattern
   200        --exclude-from stringArray            Read file exclude patterns from file (use - to read from stdin)
   201        --exclude-if-present stringArray      Exclude directories if filename is present
   202        --files-from stringArray              Read list of source-file names from file (use - to read from stdin)
   203        --files-from-raw stringArray          Read list of source-file names from file without any processing of lines (use - to read from stdin)
   204    -f, --filter stringArray                  Add a file filtering rule
   205        --filter-from stringArray             Read file filtering patterns from a file (use - to read from stdin)
   206        --ignore-case                         Ignore case in filters (case insensitive)
   207        --include stringArray                 Include files matching pattern
   208        --include-from stringArray            Read file include patterns from file (use - to read from stdin)
   209        --max-age Duration                    Only transfer files younger than this in s or suffix ms|s|m|h|d|w|M|y (default off)
   210        --max-depth int                       If set limits the recursion depth to this (default -1)
   211        --max-size SizeSuffix                 Only transfer files smaller than this in KiB or suffix B|K|M|G|T|P (default off)
   212        --metadata-exclude stringArray        Exclude metadatas matching pattern
   213        --metadata-exclude-from stringArray   Read metadata exclude patterns from file (use - to read from stdin)
   214        --metadata-filter stringArray         Add a metadata filtering rule
   215        --metadata-filter-from stringArray    Read metadata filtering patterns from a file (use - to read from stdin)
   216        --metadata-include stringArray        Include metadatas matching pattern
   217        --metadata-include-from stringArray   Read metadata include patterns from file (use - to read from stdin)
   218        --min-age Duration                    Only transfer files older than this in s or suffix ms|s|m|h|d|w|M|y (default off)
   219        --min-size SizeSuffix                 Only transfer files bigger than this in KiB or suffix B|K|M|G|T|P (default off)
   220  ```
   221  
   222  ## Listing Options
   223  
   224  Flags for listing directories.
   225  
   226  ```
   227        --default-time Time   Time to show if modtime is unknown for files and directories (default 2000-01-01T00:00:00Z)
   228        --fast-list           Use recursive list if available; uses more memory but fewer transactions
   229  ```
   230  
   231  See the [global flags page](/flags/) for global options not listed here.
   232  
   233  # SEE ALSO
   234  
   235  * [rclone](/commands/rclone/)	 - Show help for rclone commands, flags and backends.
   236