2016-08-04 04:36:28 +08:00
---
title: "rclone sync"
2020-05-16 22:11:55 +08:00
description: "Make source and dest identical, modifying destination only."
2020-02-10 20:31:45 +08:00
# autogenerated - DO NOT EDIT, instead edit the source code in cmd/sync/ and as part of making a release run "make commanddocs"
2016-08-04 04:36:28 +08:00
---
2020-05-22 18:17:37 +08:00
# rclone sync
2016-08-04 04:36:28 +08:00
Make source and dest identical, modifying destination only.
2020-05-22 18:17:37 +08:00
## Synopsis
2016-08-04 04:36:28 +08:00
Sync the source to the destination, changing the destination
2021-11-01 23:42:05 +08:00
only. Doesn't transfer files that are identical on source and
destination, testing by size and modification time or MD5SUM.
Destination is updated to match source, including deleting files
2022-07-10 01:08:20 +08:00
if necessary (except duplicate objects, see below). If you don't
want to delete files from destination, use the
[copy ](/commands/rclone_copy/ ) command instead.
2016-08-04 04:36:28 +08:00
**Important**: Since this can cause data loss, test first with the
2020-09-02 23:59:04 +08:00
`--dry-run` or the `--interactive` /`-i` flag.
2023-01-21 04:47:36 +08:00
rclone sync --interactive SOURCE remote:DESTINATION
2016-08-04 04:36:28 +08:00
Note that files in the destination won't be deleted if there were any
2021-04-01 02:12:08 +08:00
errors at any point. Duplicate objects (files with the same name, on
those providers that support it) are also not yet handled.
2016-08-04 04:36:28 +08:00
It is always the contents of the directory that is synced, not the
2022-06-19 21:26:53 +08:00
directory itself. So when source:path is a directory, it's the contents of
2016-08-04 04:36:28 +08:00
source:path that are copied, not the directory name and contents. See
2022-07-10 01:08:20 +08:00
extended explanation in the [copy ](/commands/rclone_copy/ ) command if unsure.
2016-08-04 04:36:28 +08:00
If dest:path doesn't exist, it is created and the source:path contents
go there.
2022-10-21 22:06:08 +08:00
It is not possible to sync overlapping remotes. However, you may exclude
the destination from the sync with a filter rule or by putting an
exclude-if-present file inside the destination directory and sync to a
destination that is inside the source directory.
2024-03-10 19:22:43 +08:00
Rclone will sync the modification times of files and directories if
the backend supports it. If metadata syncing is required then use the
`--metadata` flag.
Note that the modification time and metadata for the root directory
will **not** be synced. See https://github.com/rclone/rclone/issues/7652
for more info.
2018-11-24 21:44:25 +08:00
**Note**: Use the `-P` /`--progress` flag to view real-time transfer statistics
2021-04-01 02:12:08 +08:00
**Note**: Use the `rclone dedupe` command to deal with "Duplicate object/directory found in source/destination - ignoring" errors.
See [this forum post ](https://forum.rclone.org/t/sync-not-clearing-duplicates/14372 ) for more info.
2024-03-10 19:22:43 +08:00
# Logger Flags
2023-11-06 15:45:51 +08:00
2024-03-10 19:22:43 +08:00
The `--differ` , `--missing-on-dst` , `--missing-on-src` , `--match` and `--error` flags write paths, one per line, to the file name (or
2023-11-06 15:45:51 +08:00
stdout if it is `-` ) supplied. What they write is described in the
help below. For example `--differ` will write all paths which are
present on both the source and destination but different.
The `--combined` flag will write a file (or stdout) which contains all
file paths with a symbol and then a space and then the path to tell
you what happened to it. These are reminiscent of diff files.
- `= path` means path was found in source and destination and was identical
- `- path` means path was missing on the source, so only in the destination
- `+ path` means path was missing on the destination, so only in the source
- `* path` means path was present in source and destination but different.
- `! path` means there was an error reading or hashing the source or dest.
The `--dest-after` flag writes a list file using the same format flags
as [`lsf` ](/commands/rclone_lsf/#synopsis ) (including [customizable options
for hash, modtime, etc.](/commands/rclone_lsf/#synopsis))
Conceptually it is similar to rsync's `--itemize-changes` , but not identical
-- it should output an accurate list of what will be on the destination
after the sync.
Note that these logger flags have a few limitations, and certain scenarios
are not currently supported:
- `--max-duration` / `CutoffModeHard`
- `--compare-dest` / `--copy-dest`
- server-side moves of an entire dir at once
- High-level retries, because there would be duplicates (use `--retries 1` to disable)
- Possibly some unusual error scenarios
Note also that each file is logged during the sync, as opposed to after, so it
is most useful as a predictor of what SHOULD happen to each file
(which may or may not match what actually DID.)
2016-08-04 04:36:28 +08:00
2024-03-10 19:22:43 +08:00
2016-08-04 04:36:28 +08:00
```
2017-09-30 21:19:47 +08:00
rclone sync source:path dest:path [flags]
```
2020-05-22 18:17:37 +08:00
## Options
2017-09-30 21:19:47 +08:00
```
2024-03-10 19:22:43 +08:00
--absolute Put a leading / in front of path names
--combined string Make a combined report of changes to this file
2019-04-13 18:01:58 +08:00
--create-empty-src-dirs Create empty source dirs on destination after sync
2024-03-10 19:22:43 +08:00
--csv Output in CSV format
--dest-after string Report all files that exist on the dest post-sync
--differ string Report all non-matching files to this file
-d, --dir-slash Append a slash to directory names (default true)
--dirs-only Only list directories
--error string Report all files with errors (hashing or reading) to this file
--files-only Only list files (default true)
-F, --format string Output format - see lsf help for details (default "p")
--hash h Use this hash when h is used in the format MD5|SHA-1|DropboxHash (default "md5")
2019-04-13 18:01:58 +08:00
-h, --help help for sync
2024-03-10 19:22:43 +08:00
--match string Report all matching files to this file
--missing-on-dst string Report all files missing from the destination to this file
--missing-on-src string Report all files missing from the source to this file
-s, --separator string Separator for the items in the format (default ";")
-t, --timeformat string Specify a custom time format, or 'max' for max precision supported by remote (default: 2006-01-02 15:04:05)
2016-08-04 04:36:28 +08:00
```
2023-08-02 17:02:38 +08:00
## Copy Options
Flags for anything which can Copy a file.
```
--check-first Do all the checks before starting transfers
2023-09-11 22:59:44 +08:00
-c, --checksum Check for changes with size & checksum (if available, or fallback to size only).
2023-08-02 17:02:38 +08:00
--compare-dest stringArray Include additional comma separated server-side paths during comparison
--copy-dest stringArray Implies --compare-dest but also copies files from paths into destination
2023-11-26 23:59:12 +08:00
--cutoff-mode HARD|SOFT|CAUTIOUS Mode to stop transfers when reaching the max transfer limit HARD|SOFT|CAUTIOUS (default HARD)
2023-08-02 17:02:38 +08:00
--ignore-case-sync Ignore case when synchronizing
--ignore-checksum Skip post copy check of checksums
--ignore-existing Skip all files that exist on destination
2023-11-26 23:59:12 +08:00
--ignore-size Ignore size when skipping use modtime or checksum
2024-03-10 19:22:43 +08:00
-I, --ignore-times Don't skip items that match size and time - transfer all unconditionally
2023-08-02 17:02:38 +08:00
--immutable Do not modify files, fail if existing files have been modified
--inplace Download directly to destination file instead of atomic download to temp/rename
--max-backlog int Maximum number of objects in sync or check backlog (default 10000)
--max-duration Duration Maximum duration rclone will transfer data for (default 0s)
--max-transfer SizeSuffix Maximum size of data to transfer (default off)
-M, --metadata If set, preserve metadata when copying objects
--modify-window Duration Max time diff to be considered the same (default 1ns)
2023-09-11 22:59:44 +08:00
--multi-thread-chunk-size SizeSuffix Chunk size for multi-thread downloads / uploads, if not set by filesystem (default 64Mi)
--multi-thread-cutoff SizeSuffix Use multi-thread downloads for files above this size (default 256Mi)
--multi-thread-streams int Number of streams to use for multi-thread downloads (default 4)
2023-08-02 17:02:38 +08:00
--multi-thread-write-buffer-size SizeSuffix In memory buffer size for writing when in multi-thread mode (default 128Ki)
--no-check-dest Don't check the destination, copy regardless
--no-traverse Don't traverse destination file system on copy
2024-03-10 19:22:43 +08:00
--no-update-dir-modtime Don't update directory modification times
2023-11-26 23:59:12 +08:00
--no-update-modtime Don't update destination modtime if files identical
2023-08-02 17:02:38 +08:00
--order-by string Instructions on how to order the transfers, e.g. 'size,descending'
2023-11-26 23:59:12 +08:00
--partial-suffix string Add partial-suffix to temporary file name when --inplace is not used (default ".partial")
2023-08-02 17:02:38 +08:00
--refresh-times Refresh the modtime of remote files
--server-side-across-configs Allow server-side operations (e.g. copy) to work across different configs
2023-11-26 23:59:12 +08:00
--size-only Skip based on size only, not modtime or checksum
2023-08-02 17:02:38 +08:00
--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)
-u, --update Skip files that are newer on the destination
```
## Sync Options
Flags just used for `rclone sync` .
```
--backup-dir string Make backups into hierarchy based in DIR
--delete-after When synchronizing, delete files on destination after transferring (default)
--delete-before When synchronizing, delete files on destination before transferring
--delete-during When synchronizing, delete files during transfer
2024-03-10 19:22:43 +08:00
--fix-case Force rename of case insensitive dest to match source
2023-08-02 17:02:38 +08:00
--ignore-errors Delete even if there are I/O errors
--max-delete int When synchronizing, limit the number of deletes (default -1)
--max-delete-size SizeSuffix When synchronizing, limit the total size of deletes (default off)
--suffix string Suffix to add to changed files
--suffix-keep-extension Preserve the extension when using --suffix
--track-renames When synchronizing, track file renames and do a server-side move if possible
--track-renames-strategy string Strategies to use when synchronizing using track-renames hash|modtime|leaf (default "hash")
```
## Important Options
Important flags useful for most commands.
```
-n, --dry-run Do a trial run with no permanent changes
-i, --interactive Enable interactive mode
-v, --verbose count Print lots more stuff (repeat for more)
```
## Filter Options
Flags for filtering directory listings.
```
--delete-excluded Delete files on dest excluded from sync
--exclude stringArray Exclude files matching pattern
--exclude-from stringArray Read file exclude patterns from file (use - to read from stdin)
--exclude-if-present stringArray Exclude directories if filename is present
--files-from stringArray Read list of source-file names from file (use - to read from stdin)
--files-from-raw stringArray Read list of source-file names from file without any processing of lines (use - to read from stdin)
-f, --filter stringArray Add a file filtering rule
--filter-from stringArray Read file filtering patterns from a file (use - to read from stdin)
--ignore-case Ignore case in filters (case insensitive)
--include stringArray Include files matching pattern
--include-from stringArray Read file include patterns from file (use - to read from stdin)
--max-age Duration Only transfer files younger than this in s or suffix ms|s|m|h|d|w|M|y (default off)
--max-depth int If set limits the recursion depth to this (default -1)
--max-size SizeSuffix Only transfer files smaller than this in KiB or suffix B|K|M|G|T|P (default off)
--metadata-exclude stringArray Exclude metadatas matching pattern
--metadata-exclude-from stringArray Read metadata exclude patterns from file (use - to read from stdin)
--metadata-filter stringArray Add a metadata filtering rule
--metadata-filter-from stringArray Read metadata filtering patterns from a file (use - to read from stdin)
--metadata-include stringArray Include metadatas matching pattern
--metadata-include-from stringArray Read metadata include patterns from file (use - to read from stdin)
--min-age Duration Only transfer files older than this in s or suffix ms|s|m|h|d|w|M|y (default off)
--min-size SizeSuffix Only transfer files bigger than this in KiB or suffix B|K|M|G|T|P (default off)
```
## Listing Options
Flags for listing directories.
```
--default-time Time Time to show if modtime is unknown for files and directories (default 2000-01-01T00:00:00Z)
--fast-list Use recursive list if available; uses more memory but fewer transactions
```
2019-06-20 23:18:02 +08:00
See the [global flags page ](/flags/ ) for global options not listed here.
2023-08-02 17:02:38 +08:00
# SEE ALSO
2016-08-04 04:36:28 +08:00
2018-10-15 18:03:08 +08:00
* [rclone ](/commands/rclone/ ) - Show help for rclone commands, flags and backends.
2018-03-19 18:06:13 +08:00