rclone/docs/content/commands/rclone_copy.md

183 lines
9.3 KiB
Markdown
Raw Normal View History

---
title: "rclone copy"
2021-11-01 23:42:05 +08:00
description: "Copy files from source to dest, skipping identical files."
# autogenerated - DO NOT EDIT, instead edit the source code in cmd/copy/ and as part of making a release run "make commanddocs"
---
# rclone copy
2021-11-01 23:42:05 +08:00
Copy files from source to dest, skipping identical files.
## Synopsis
2021-11-01 23:42:05 +08:00
Copy the source to the destination. Does not transfer files that are
identical on source and destination, testing by size and modification
2022-07-10 01:08:20 +08:00
time or MD5SUM. Doesn't delete files from the destination. If you
want to also delete files from destination, to make it match source,
use the [sync](/commands/rclone_sync/) command instead.
2021-11-01 23:42:05 +08:00
Note that it is always the contents of the directory that is synced,
2022-07-10 01:08:20 +08:00
not the directory itself. So when source:path is a directory, it's the
2021-11-01 23:42:05 +08:00
contents of source:path that are copied, not the directory name and
contents.
2022-07-10 01:08:20 +08:00
To copy single files, use the [copyto](/commands/rclone_copyto/)
command instead.
2021-11-01 23:42:05 +08:00
If dest:path doesn't exist, it is created and the source:path contents
go there.
For example
rclone copy source:sourcepath dest:destpath
2021-11-01 23:42:05 +08:00
Let's say there are two files in sourcepath
sourcepath/one.txt
sourcepath/two.txt
2021-11-01 23:42:05 +08:00
This copies them to
destpath/one.txt
destpath/two.txt
2021-11-01 23:42:05 +08:00
Not to
destpath/sourcepath/one.txt
destpath/sourcepath/two.txt
If you are familiar with `rsync`, rclone always works as if you had
2021-02-02 21:42:35 +08:00
written a trailing `/` - meaning "copy the contents of this directory".
This applies to all commands and whether you are talking about the
source or destination.
2019-02-09 18:42:57 +08:00
See the [--no-traverse](/docs/#no-traverse) option for controlling
whether rclone lists the destination directory or not. Supplying this
option when copying a small number of files into a large destination
can speed transfers up greatly.
For example, if you have many files in /path/to/src but only a few of
them change every day, you can copy all the files which have changed
recently very efficiently like this:
2019-02-09 18:42:57 +08:00
rclone copy --max-age 24h --no-traverse /path/to/src remote:
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.
2020-09-02 23:59:04 +08:00
**Note**: Use the `-P`/`--progress` flag to view real-time transfer statistics.
**Note**: Use the `--dry-run` or the `--interactive`/`-i` flag to test without copying anything.
2018-11-24 21:44:25 +08:00
```
2017-09-30 21:19:47 +08:00
rclone copy source:path dest:path [flags]
```
## Options
2017-09-30 21:19:47 +08:00
```
2019-04-13 18:01:58 +08:00
--create-empty-src-dirs Create empty source dirs on destination after copy
-h, --help help for copy
```
2024-09-08 23:21:56 +08:00
Options shared with other commands are described next.
See the [global flags page](/flags/) for global options not listed here.
2023-08-02 17:02:38 +08:00
2024-09-08 23:21:56 +08:00
### Copy Options
2023-08-02 17:02:38 +08:00
2024-09-08 23:21:56 +08:00
Flags for anything which can copy a file
2023-08-02 17:02:38 +08:00
```
--check-first Do all the checks before starting transfers
2024-09-08 23:21:56 +08:00
-c, --checksum Check for changes with size & checksum (if available, or fallback to size only)
--compare-dest stringArray Include additional server-side paths during comparison
2023-08-02 17:02:38 +08:00
--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
```
2024-09-08 23:21:56 +08:00
### Important Options
2023-08-02 17:02:38 +08:00
2024-09-08 23:21:56 +08:00
Important flags useful for most commands
2023-08-02 17:02:38 +08:00
```
-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)
```
2024-09-08 23:21:56 +08:00
### Filter Options
2023-08-02 17:02:38 +08:00
2024-09-08 23:21:56 +08:00
Flags for filtering directory listings
2023-08-02 17:02:38 +08:00
```
--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)
```
2024-09-08 23:21:56 +08:00
### Listing Options
2023-08-02 17:02:38 +08:00
2024-09-08 23:21:56 +08:00
Flags for listing directories
2023-08-02 17:02:38 +08:00
```
--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
```
2024-09-08 23:21:56 +08:00
## See Also
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