2014-03-28 22:34:13 +00:00
---
title: "Documentation"
2015-06-06 09:05:21 +00:00
description: "Rclone Usage"
2014-03-28 22:34:13 +00:00
---
2021-09-25 19:09:48 +00:00
# Usage
Rclone is a command line program to manage files on cloud storage.
After [download ](/downloads/ ) and [install ](/install ), continue
here to learn how to use it: Initial [configuration ](#configure ),
what the [basic syntax ](#basic-syntax ) looks like, describes the
various [subcommands ](#subcommands ), the various [options ](#options ),
and more.
2014-03-28 22:34:13 +00:00
Configure
---------
2017-06-25 21:29:51 +00:00
First, you'll need to configure rclone. As the object storage systems
2017-01-14 03:47:55 +00:00
have quite complicated authentication these are kept in a config file.
2021-03-27 16:26:01 +00:00
(See the [`--config` ](#config-config-file ) entry for how to find the config
file and choose its location.)
2014-03-28 22:34:13 +00:00
The easiest way to make the config is to run rclone with the config
option:
rclone config
2015-06-06 09:05:21 +00:00
See the following for detailed instructions for
2014-03-28 22:34:13 +00:00
2019-06-26 18:39:01 +00:00
* [1Fichier ](/fichier/ )
2021-10-14 22:01:46 +00:00
* [Akamai Netstorage ](/netstorage/ )
2018-02-06 18:23:47 +00:00
* [Alias ](/alias/ )
2014-03-28 22:34:13 +00:00
* [Amazon S3 ](/s3/ )
2017-07-08 22:31:58 +00:00
* [Backblaze B2 ](/b2/ )
* [Box ](/box/ )
2019-08-30 14:18:40 +00:00
* [Chunker ](/chunker/ ) - transparently splits large files for other remotes
2019-08-27 21:50:07 +00:00
* [Citrix ShareFile ](/sharefile/ )
2020-12-02 00:47:07 +00:00
* [Compress ](/compress/ )
2022-04-20 16:57:43 +00:00
* [Combine ](/combine/ )
2017-07-08 22:31:58 +00:00
* [Crypt ](/crypt/ ) - to encrypt other remotes
2017-10-19 16:31:25 +00:00
* [DigitalOcean Spaces ](/s3/#digitalocean-spaces )
2022-03-08 10:56:53 +00:00
* [Digi Storage ](/koofr/#digi-storage )
2015-06-06 09:05:21 +00:00
* [Dropbox ](/dropbox/ )
2020-08-11 14:09:00 +00:00
* [Enterprise File Fabric ](/filefabric/ )
2024-07-23 15:41:40 +00:00
* [Files.com ](/filescom/ )
2017-07-08 22:31:58 +00:00
* [FTP ](/ftp/ )
2024-07-25 15:53:19 +00:00
* [Gofile ](/gofile/ )
2015-09-04 10:06:25 +00:00
* [Google Cloud Storage ](/googlecloudstorage/ )
2017-07-08 22:31:58 +00:00
* [Google Drive ](/drive/ )
2019-06-17 16:50:58 +00:00
* [Google Photos ](/googlephotos/ )
2021-10-12 12:16:58 +00:00
* [Hasher ](/hasher/ ) - to handle checksums for other remotes
2020-09-28 17:29:44 +00:00
* [HDFS ](/hdfs/ )
2024-08-28 06:25:49 +00:00
* [Hetzner Storage Box ](/sftp/#hetzner-storage-box )
2022-07-07 17:58:22 +00:00
* [HiDrive ](/hidrive/ )
2017-07-08 22:31:58 +00:00
* [HTTP ](/http/ )
2022-04-12 09:38:44 +00:00
* [Internet Archive ](/internetarchive/ )
2021-09-06 16:54:27 +00:00
* [Jottacloud ](/jottacloud/ )
2019-02-22 15:50:04 +00:00
* [Koofr ](/koofr/ )
2023-10-20 11:35:56 +00:00
* [Linkbox ](/linkbox/ )
2019-09-09 20:56:16 +00:00
* [Mail.ru Cloud ](/mailru/ )
2017-10-15 10:45:39 +00:00
* [Mega ](/mega/ )
2018-05-03 15:31:06 +00:00
* [Memory ](/memory/ )
2017-07-25 14:18:13 +00:00
* [Microsoft Azure Blob Storage ](/azureblob/ )
2023-11-15 09:37:57 +00:00
* [Microsoft Azure Files Storage ](/azurefiles/ )
2017-03-08 11:21:57 +00:00
* [Microsoft OneDrive ](/onedrive/ )
2023-05-19 14:00:17 +00:00
* [OpenStack Swift / Rackspace Cloudfiles / Blomp Cloud Storage / Memset Memstore ](/swift/ )
2017-07-17 05:36:45 +00:00
* [OpenDrive ](/opendrive/ )
2022-10-20 19:24:19 +00:00
* [Oracle Object Storage ](/oracleobjectstorage/ )
2017-09-19 15:09:43 +00:00
* [Pcloud ](/pcloud/ )
2023-04-04 15:33:48 +00:00
* [PikPak ](/pikpak/ )
2024-08-12 12:35:44 +00:00
* [Pixeldrain ](/pixeldrain/ )
2019-07-05 23:16:57 +00:00
* [premiumize.me ](/premiumizeme/ )
2019-08-06 12:47:52 +00:00
* [put.io ](/putio/ )
2023-09-10 10:55:37 +00:00
* [Proton Drive ](/protondrive/ )
2017-06-25 23:47:54 +00:00
* [QingStor ](/qingstor/ )
2023-09-08 13:31:29 +00:00
* [Quatrix by Maytech ](/quatrix/ )
2024-08-28 06:25:49 +00:00
* [rsync.net ](/sftp/#rsync-net )
2020-04-25 17:55:18 +00:00
* [Seafile ](/seafile/ )
2017-01-31 20:34:11 +00:00
* [SFTP ](/sftp/ )
2021-10-10 12:24:23 +00:00
* [Sia ](/sia/ )
2022-09-30 15:10:57 +00:00
* [SMB ](/smb/ )
2022-02-04 17:58:04 +00:00
* [Storj ](/storj/ )
2019-10-24 11:35:50 +00:00
* [SugarSync ](/sugarsync/ )
2018-08-18 00:39:49 +00:00
* [Union ](/union/ )
2024-03-26 09:46:47 +00:00
* [Uloz.to ](/ulozto/ )
2021-04-09 14:57:24 +00:00
* [Uptobox ](/uptobox/ )
2017-10-02 19:29:23 +00:00
* [WebDAV ](/webdav/ )
2017-07-08 22:31:58 +00:00
* [Yandex Disk ](/yandex/ )
2020-10-07 22:17:50 +00:00
* [Zoho WorkDrive ](/zoho/ )
2017-07-08 22:31:58 +00:00
* [The local filesystem ](/local/ )
2014-03-28 22:34:13 +00:00
2021-09-25 19:09:48 +00:00
Basic syntax
2014-03-28 22:34:13 +00:00
-----
Rclone syncs a directory tree from one storage system to another.
Its syntax is like this
2024-04-05 14:57:50 +00:00
rclone subcommand [options] < parameters > < parameters... >
A `subcommand` is a the rclone operation required, (e.g. `sync` ,
`copy` , `ls` ).
An `option` is a single letter flag (e.g. `-v` ) or a group of single
letter flags (e.g. `-Pv` ) or a long flag (e.g. `--progress` ). No
options are required. Options can come after the `subcommand` or in
between parameters too or on the end, but only global options can be
used before the `subcommand` . Anything after a `--` option will not be
interpreted as an option so if you need to add a parameter which
starts with a `-` then put a `--` on its own first, eg
rclone lsf -- -directory-starting-with-dash
A `parameter` is usually a file path or [rclone remote ](#syntax-of-remote-paths ), eg
`/path/to/file` or `remote:path/to/file` but it can be other things -
the `subcommand` help will tell you what.
2014-03-28 22:34:13 +00:00
Source and destination paths are specified by the name you gave the
2020-10-13 21:49:58 +00:00
storage system in the config file then the sub path, e.g.
2014-03-28 22:34:13 +00:00
"drive:myfolder" to look at "myfolder" in Google drive.
You can define as many storage paths as you like in the config file.
2023-01-20 20:47:36 +00:00
Please use the [`--interactive`/`-i` ](#interactive ) flag while
2020-06-05 15:13:10 +00:00
learning rclone to avoid accidental data loss.
2014-03-28 22:34:13 +00:00
Subcommands
-----------
2016-08-03 20:36:28 +00:00
rclone uses a system of subcommands. For example
2019-03-25 13:16:52 +00:00
rclone ls remote:path # lists a remote
2016-08-03 20:36:28 +00:00
rclone copy /local/path remote:path # copies /local/path to the remote
2023-01-20 20:47:36 +00:00
rclone sync --interactive /local/path remote:path # syncs /local/path to the remote
2016-08-03 20:36:28 +00:00
The main rclone commands with most used first
2017-02-11 14:11:02 +00:00
* [rclone config ](/commands/rclone_config/ ) - Enter an interactive configuration session.
2018-01-19 18:39:17 +00:00
* [rclone copy ](/commands/rclone_copy/ ) - Copy files from source to dest, skipping already copied.
2017-02-11 14:11:02 +00:00
* [rclone sync ](/commands/rclone_sync/ ) - Make source and dest identical, modifying destination only.
2021-05-16 17:26:43 +00:00
* [rclone bisync ](/commands/rclone_bisync/ ) - [Bidirectional synchronization ](/bisync/ ) between two paths.
2017-02-11 14:11:02 +00:00
* [rclone move ](/commands/rclone_move/ ) - Move files from source to dest.
* [rclone delete ](/commands/rclone_delete/ ) - Remove the contents of path.
* [rclone purge ](/commands/rclone_purge/ ) - Remove the path and all of its contents.
* [rclone mkdir ](/commands/rclone_mkdir/ ) - Make the path if it doesn't already exist.
* [rclone rmdir ](/commands/rclone_rmdir/ ) - Remove the path.
2017-04-14 19:07:46 +00:00
* [rclone rmdirs ](/commands/rclone_rmdirs/ ) - Remove any empty directories under the path.
2018-01-19 18:39:17 +00:00
* [rclone check ](/commands/rclone_check/ ) - Check if the files in the source and destination match.
2017-02-11 14:11:02 +00:00
* [rclone ls ](/commands/rclone_ls/ ) - List all the objects in the path with size and path.
* [rclone lsd ](/commands/rclone_lsd/ ) - List all directories/containers/buckets in the path.
2018-01-19 18:39:17 +00:00
* [rclone lsl ](/commands/rclone_lsl/ ) - List all the objects in the path with size, modification time and path.
* [rclone md5sum ](/commands/rclone_md5sum/ ) - Produce an md5sum file for all the objects in the path.
* [rclone sha1sum ](/commands/rclone_sha1sum/ ) - Produce a sha1sum file for all the objects in the path.
* [rclone size ](/commands/rclone_size/ ) - Return the total size and number of objects in remote:path.
2017-02-11 14:11:02 +00:00
* [rclone version ](/commands/rclone_version/ ) - Show the version number.
2018-01-19 18:39:17 +00:00
* [rclone cleanup ](/commands/rclone_cleanup/ ) - Clean up the remote if possible.
* [rclone dedupe ](/commands/rclone_dedupe/ ) - Interactively find duplicate files and delete/rename them.
2017-02-11 14:11:02 +00:00
* [rclone authorize ](/commands/rclone_authorize/ ) - Remote authorization.
2018-01-19 18:39:17 +00:00
* [rclone cat ](/commands/rclone_cat/ ) - Concatenate any files and send them to stdout.
* [rclone copyto ](/commands/rclone_copyto/ ) - Copy files from source to dest, skipping already copied.
2024-01-31 16:43:20 +00:00
* [rclone completion ](/commands/rclone_completion/ ) - Output shell completion scripts for rclone.
2017-02-11 14:11:02 +00:00
* [rclone gendocs ](/commands/rclone_gendocs/ ) - Output markdown docs for rclone to the directory supplied.
* [rclone listremotes ](/commands/rclone_listremotes/ ) - List all the remotes in the config file.
2019-02-25 17:53:53 +00:00
* [rclone mount ](/commands/rclone_mount/ ) - Mount the remote as a mountpoint.
2017-02-11 14:11:02 +00:00
* [rclone moveto ](/commands/rclone_moveto/ ) - Move file or directory from source to dest.
* [rclone obscure ](/commands/rclone_obscure/ ) - Obscure password for use in the rclone.conf
2021-04-28 21:50:55 +00:00
* [rclone cryptcheck ](/commands/rclone_cryptcheck/ ) - Check the integrity of an encrypted remote.
2018-02-09 20:48:32 +00:00
* [rclone about ](/commands/rclone_about/ ) - Get quota information from the remote.
2016-08-03 20:36:28 +00:00
See the [commands index ](/commands/ ) for the full list.
2015-06-06 09:05:21 +00:00
2016-06-26 20:10:20 +00:00
Copying single files
--------------------
2017-06-25 21:29:51 +00:00
rclone normally syncs or copies directories. However, if the source
2016-06-26 20:10:20 +00:00
remote points to a file, rclone will just copy that file. The
destination remote must point to a directory - rclone will give the
error `Failed to create file system for "remote:file": is a file not a
directory` if it isn't.
For example, suppose you have a remote with a file in called
`test.jpg` , then you could copy just that file like this
rclone copy remote:test.jpg /tmp/download
The file `test.jpg` will be placed inside `/tmp/download` .
This is equivalent to specifying
2017-12-29 17:32:28 +00:00
rclone copy --files-from /tmp/files remote: /tmp/download
2016-06-26 20:10:20 +00:00
Where `/tmp/files` contains the single line
test.jpg
2017-06-25 21:29:51 +00:00
It is recommended to use `copy` when copying individual files, not `sync` .
2016-06-26 20:10:20 +00:00
They have pretty much the same effect but `copy` will use a lot less
memory.
2018-08-07 21:51:06 +00:00
Syntax of remote paths
----------------------
The syntax of the paths passed to the rclone command are as follows.
### /path/to/dir
This refers to the local file system.
2021-02-11 08:09:48 +00:00
On Windows `\` may be used instead of `/` in local paths **only** ,
2021-05-04 14:22:42 +00:00
non local paths must use `/` . See [local filesystem ](https://rclone.org/local/#paths-on-windows )
2021-02-11 08:09:48 +00:00
documentation for more about Windows-specific paths.
2018-08-07 21:51:06 +00:00
These paths needn't start with a leading `/` - if they don't then they
will be relative to the current directory.
### remote:path/to/dir
This refers to a directory `path/to/dir` on `remote:` as defined in
the config file (configured with `rclone config` ).
### remote:/path/to/dir
On most backends this is refers to the same directory as
`remote:path/to/dir` and that format should be preferred. On a very
small number of remotes (FTP, SFTP, Dropbox for business) this will
refer to a different directory. On these, paths without a leading `/`
will refer to your "home" directory and paths with a leading `/` will
refer to the root.
### :backend:path/to/dir
This is an advanced form for creating remotes on the fly. `backend`
should be the name or prefix of a backend (the `type` in the config
file) and all the configuration for the backend should be provided on
the command line (or in environment variables).
2019-02-27 09:41:40 +00:00
Here are some examples:
2018-08-07 21:51:06 +00:00
rclone lsd --http-url https://pub.rclone.org :http:
2019-02-27 09:41:40 +00:00
To list all the directories in the root of `https://pub.rclone.org/` .
rclone lsf --http-url https://example.com :http:path/to/dir
To list files and directories in `https://example.com/path/to/dir/`
rclone copy --http-url https://example.com :http:path/to/dir /tmp/dir
To copy files and directories in `https://example.com/path/to/dir` to `/tmp/dir` .
rclone copy --sftp-host example.com :sftp:path/to/dir /tmp/dir
To copy files and directories from `example.com` in the relative
directory `path/to/dir` to `/tmp/dir` using sftp.
2018-08-07 21:51:06 +00:00
2021-02-09 09:30:40 +00:00
### Connection strings {#connection-strings}
The above examples can also be written using a connection string
syntax, so instead of providing the arguments as command line
parameters `--http-url https://pub.rclone.org` they are provided as
part of the remote specification as a kind of connection string.
rclone lsd ":http,url='https://pub.rclone.org':"
rclone lsf ":http,url='https://example.com':path/to/dir"
rclone copy ":http,url='https://example.com':path/to/dir" /tmp/dir
rclone copy :sftp,host=example.com:path/to/dir /tmp/dir
These can apply to modify existing remotes as well as create new
remotes with the on the fly syntax. This example is equivalent to
adding the `--drive-shared-with-me` parameter to the remote `gdrive:` .
rclone lsf "gdrive,shared_with_me:path/to/dir"
The major advantage to using the connection string style syntax is
2021-04-26 21:37:49 +00:00
that it only applies to the remote, not to all the remotes of that
2021-02-09 09:30:40 +00:00
type of the command line. A common confusion is this attempt to copy a
file shared on google drive to the normal drive which **does not
work** because the `--drive-shared-with-me` flag applies to both the
source and the destination.
rclone copy --drive-shared-with-me gdrive:shared-file.txt gdrive:
However using the connection string syntax, this does work.
rclone copy "gdrive,shared_with_me:shared-file.txt" gdrive:
cmdtest: end-to-end test for commands, flags and environment variables
There was no easy way to automatically test the end-to-end functionality
of commands, flags, environment variables etc.
The need for end-to-end testing was highlighted by the issues fixed
in #5341. There was no automated test to continually verify current
behaviour, nor a framework to quickly test the correctness of the fixes.
This change adds an end-to-end testing framework in the cmdtest folder.
It has some simple examples in func TestCmdTest in cmdtest_test.go. The
tests should be readable by anybody familiar with rclone and look like
this:
// Test the rclone version command with debug logging (-vv)
out, err = rclone("version", "-vv")
if assert.NoError(t, err) {
assert.Contains(t, out, "rclone v")
assert.Contains(t, out, "os/version:")
assert.Contains(t, out, " DEBUG : ")
}
The end-to-end tests are executed just like the Go unit tests, that is:
go test ./cmdtest -v
The change also contains a thorough test of environment variables in
environment_test.go.
Thanks to @ncw for encouragement and introduction to the TestMain trick.
2021-06-04 08:56:40 +00:00
Note that the connection string only affects the options of the immediate
backend. If for example gdriveCrypt is a crypt based on gdrive, then the
following command **will not work** as intended, because
`shared_with_me` is ignored by the crypt backend:
rclone copy "gdriveCrypt,shared_with_me:shared-file.txt" gdriveCrypt:
2021-02-09 09:30:40 +00:00
The connection strings have the following syntax
remote,parameter=value,parameter2=value2:path/to/dir
:backend,parameter=value,parameter2=value2:path/to/dir
If the `parameter` has a `:` or `,` then it must be placed in quotes `"` or
`'` , so
remote,parameter="colon:value",parameter2="comma,value":path/to/dir
:backend,parameter='colon:value',parameter2='comma,value':path/to/dir
If a quoted value needs to include that quote, then it should be
doubled, so
remote,parameter="with""quote",parameter2='with''quote':path/to/dir
This will make `parameter` be `with"quote` and `parameter2` be
`with'quote` .
If you leave off the `=parameter` then rclone will substitute `=true`
2021-11-04 11:50:43 +00:00
which works very well with flags. For example, to use s3 configured in
2021-02-09 09:30:40 +00:00
the environment you could use:
rclone lsd :s3,env_auth:
Which is equivalent to
rclone lsd :s3,env_auth=true:
Note that on the command line you might need to surround these
connection strings with `"` or `'` to stop the shell interpreting any
special characters within them.
If you are a shell master then you'll know which strings are OK and
which aren't, but if you aren't sure then enclose them in `"` and use
`'` as the inside quote. This syntax works on all OSes.
rclone copy ":http,url='https://example.com':path/to/dir" /tmp/dir
On Linux/macOS some characters are still interpreted inside `"`
strings in the shell (notably `\` and `$` and `"` ) so if your strings
contain those you can swap the roles of `"` and `'` thus. (This syntax
does not work on Windows.)
rclone copy ':http,url="https://example.com":path/to/dir' /tmp/dir
2021-03-10 14:10:03 +00:00
#### Connection strings, config and logging
If you supply extra configuration to a backend by command line flag,
environment variable or connection string then rclone will add a
suffix based on the hash of the config to the name of the remote, eg
rclone -vv lsf --s3-chunk-size 20M s3:
Has the log message
DEBUG : s3: detected overridden config - adding "{Srj1p}" suffix to name
This is so rclone can tell the modified remote apart from the
unmodified remote when caching the backends.
This should only be noticeable in the logs.
This means that on the fly backends such as
rclone -vv lsf :s3,env_auth:
Will get their own names
DEBUG : :s3: detected overridden config - adding "{YTu53}" suffix to name
2020-06-16 11:31:12 +00:00
### Valid remote names
2021-09-16 18:02:16 +00:00
Remote names are case sensitive, and must adhere to the following rules:
2023-01-19 20:38:24 +00:00
- May contain number, letter, `_` , `-` , `.` , `+` , `@` and space.
2021-09-16 18:02:16 +00:00
- May not start with `-` or space.
2022-09-16 14:59:08 +00:00
- May not end with space.
2020-06-16 11:31:12 +00:00
2022-12-10 14:53:42 +00:00
Starting with rclone version 1.61, any Unicode numbers and letters are allowed,
while in older versions it was limited to plain ASCII (0-9, A-Z, a-z). If you use
the same rclone configuration from different shells, which may be configured with
different character encoding, you must be cautious to use characters that are
possible to write in all of them. This is mostly a problem on Windows, where
the console traditionally uses a non-Unicode character set - defined
by the so-called "code page".
2023-09-01 10:00:14 +00:00
Do not use single character names on Windows as it creates ambiguity with Windows
drives' names, e.g.: remote called `C` is indistinguishable from `C` drive. Rclone
will always assume that single letter name refers to a drive.
2016-06-17 15:28:50 +00:00
Quoting and the shell
---------------------
When you are typing commands to your computer you are using something
called the command line shell. This interprets various characters in
an OS specific way.
Here are some gotchas which may help users unfamiliar with the shell rules
### Linux / OSX ###
2020-10-13 21:49:58 +00:00
If your names have spaces or shell metacharacters (e.g. `*` , `?` , `$` ,
2020-10-13 22:07:12 +00:00
`'` , `"` , etc.) then you must quote them. Use single quotes `'` by default.
2016-06-17 15:28:50 +00:00
rclone copy 'Important files?' remote:backup
2020-10-13 21:49:58 +00:00
If you want to send a `'` you will need to use `"` , e.g.
2016-06-17 15:28:50 +00:00
rclone copy "O'Reilly Reviews" remote:backup
The rules for quoting metacharacters are complicated and if you want
the full details you'll have to consult the manual page for your
shell.
### Windows ###
2020-10-13 21:49:58 +00:00
If your names have spaces in you need to put them in `"` , e.g.
2016-06-17 15:28:50 +00:00
rclone copy "E:\folder name\folder name\folder name" remote:backup
If you are using the root directory on its own then don't quote it
2020-10-13 21:49:58 +00:00
(see [#464 ](https://github.com/rclone/rclone/issues/464 ) for why), e.g.
2016-06-17 15:28:50 +00:00
rclone copy E:\ remote:backup
2017-06-26 15:13:12 +00:00
Copying files or directories with `:` in the names
--------------------------------------------------
rclone uses `:` to mark a remote name. This is, however, a valid
filename component in non-Windows OSes. The remote name parser will
only search for a `:` up to the first `/` so if you need to act on a
file or directory like this then use the full path starting with a
`/` , or use `./` as a current directory prefix.
So to sync a directory called `sync:me` to a remote called `remote:` use
2023-01-20 20:47:36 +00:00
rclone sync --interactive ./sync:me remote:path
2017-06-26 15:13:12 +00:00
or
2023-01-20 20:47:36 +00:00
rclone sync --interactive /full/path/to/sync:me remote:path
2017-06-26 15:13:12 +00:00
2015-02-14 18:48:08 +00:00
Server Side Copy
----------------
2017-01-05 21:11:46 +00:00
Most remotes (but not all - see [the
2020-10-13 21:43:40 +00:00
overview](/overview/#optional-features)) support server-side copy.
2015-02-14 18:48:08 +00:00
This means if you want to copy one folder to another then rclone won't
download all the files and re-upload them; it will instruct the server
to copy them in place.
Eg
rclone copy s3:oldbucket s3:newbucket
Will copy the contents of `oldbucket` to `newbucket` without
downloading and re-uploading.
2020-10-13 21:43:40 +00:00
Remotes which don't support server-side copy **will** download and
2017-01-05 21:11:46 +00:00
re-upload in this case.
2015-02-14 18:48:08 +00:00
Server side copies are used with `sync` and `copy` and will be
2017-06-26 15:00:57 +00:00
identified in the log when using the `-v` flag. The `move` command
2020-10-13 21:43:40 +00:00
may also use them if remote doesn't support server-side move directly.
This is done by issuing a server-side copy then a delete which is much
2017-06-26 15:00:57 +00:00
quicker than a download and re-upload.
2015-02-14 18:48:08 +00:00
Server side copies will only be attempted if the remote names are the
same.
2020-10-13 21:49:58 +00:00
This can be used when scripting to make aged backups efficiently, e.g.
2015-02-14 18:48:08 +00:00
2023-01-20 20:47:36 +00:00
rclone sync --interactive remote:current-backup remote:previous-backup
rclone sync --interactive /path/to/files remote:current-backup
2015-02-14 18:48:08 +00:00
2022-05-24 10:00:00 +00:00
## Metadata support {#metadata}
2024-02-06 16:00:34 +00:00
Metadata is data about a file (or directory) which isn't the contents
of the file (or directory). Normally rclone only preserves the
modification time and the content (MIME) type where possible.
2022-05-24 10:00:00 +00:00
2024-02-06 16:00:34 +00:00
Rclone supports preserving all the available metadata on files and
directories when using the `--metadata` or `-M` flag.
2022-05-24 10:00:00 +00:00
Exactly what metadata is supported and what that support means depends
on the backend. Backends that support metadata have a metadata section
in their docs and are listed in the [features table ](/overview/#features )
(Eg [local ](/local/#metadata ), [s3 ](/s3/#metadata ))
2024-02-06 16:00:34 +00:00
Some backends don't support metadata, some only support metadata on
files and some support metadata on both files and directories.
2022-05-24 10:00:00 +00:00
Rclone only supports a one-time sync of metadata. This means that
metadata will be synced from the source object to the destination
object only when the source object has changed and needs to be
re-uploaded. If the metadata subsequently changes on the source object
without changing the object itself then it won't be synced to the
destination object. This is in line with the way rclone syncs
`Content-Type` without the `--metadata` flag.
Using `--metadata` when syncing from local to local will preserve file
attributes such as file mode, owner, extended attributes (not
Windows).
Note that arbitrary metadata may be added to objects using the
2022-05-24 14:46:07 +00:00
`--metadata-set key=value` flag when the object is first uploaded.
2022-05-24 10:00:00 +00:00
This flag can be repeated as many times as necessary.
2023-10-23 22:47:18 +00:00
The [--metadata-mapper ](#metadata-mapper ) flag can be used to pass the
name of a program in which can transform metadata when it is being
copied from source to destination.
2024-03-09 14:13:18 +00:00
Rclone supports `--metadata-set` and `--metadata-mapper` when doing
sever side `Move` and server side `Copy` , but not when doing server
side `DirMove` (renaming a directory) as this would involve recursing
into the directory. Note that you can disable `DirMove` with
`--disable DirMove` and rclone will revert back to using `Move` for
each individual object where `--metadata-set` and `--metadata-mapper`
are supported.
2022-05-24 10:00:00 +00:00
### Types of metadata
Metadata is divided into two type. System metadata and User metadata.
Metadata which the backend uses itself is called system metadata. For
example on the local backend the system metadata `uid` will store the
user ID of the file when used on a unix based platform.
Arbitrary metadata is called user metadata and this can be set however
is desired.
When objects are copied from backend to backend, they will attempt to
interpret system metadata if it is supplied. Metadata may change from
being user metadata to system metadata as objects are copied between
different backends. For example copying an object from s3 sets the
`content-type` metadata. In a backend which understands this (like
`azureblob` ) this will become the Content-Type of the object. In a
backend which doesn't understand this (like the `local` backend) this
will become user metadata. However should the local object be copied
back to s3, the Content-Type will be set correctly.
### Metadata framework
Rclone implements a metadata framework which can read metadata from an
object and write it to the object when (and only when) it is being
uploaded.
This metadata is stored as a dictionary with string keys and string
values.
There are some limits on the names of the keys (these may be clarified
further in the future).
- must be lower case
- may be `a-z` `0-9` containing `.` `-` or `_`
- length is backend dependent
Each backend can provide system metadata that it understands. Some
backends can also store arbitrary user metadata.
Where possible the key names are standardized, so, for example, it is
possible to copy object metadata from s3 to azureblob for example and
2022-08-14 02:56:32 +00:00
metadata will be translated appropriately.
2022-05-24 10:00:00 +00:00
Some backends have limits on the size of the metadata and rclone will
give errors on upload if they are exceeded.
### Metadata preservation
The goal of the implementation is to
1. Preserve metadata if at all possible
2. Interpret metadata if at all possible
The consequences of 1 is that you can copy an S3 object to a local
disk then back to S3 losslessly. Likewise you can copy a local file
with file attributes and xattrs from local disk to s3 and back again
losslessly.
The consequence of 2 is that you can copy an S3 object with metadata
to Azureblob (say) and have the metadata appear on the Azureblob
object also.
### Standard system metadata
Here is a table of standard system metadata which, if appropriate, a
backend may implement.
| key | description | example |
|---------------------|-------------|---------|
| mode | File type and mode: octal, unix style | 0100664 |
| uid | User ID of owner: decimal number | 500 |
| gid | Group ID of owner: decimal number | 500 |
| rdev | Device ID (if special file) => hexadecimal | 0 |
| atime | Time of last access: RFC 3339 | 2006-01-02T15:04:05.999999999Z07:00 |
| mtime | Time of last modification: RFC 3339 | 2006-01-02T15:04:05.999999999Z07:00 |
| btime | Time of file creation (birth): RFC 3339 | 2006-01-02T15:04:05.999999999Z07:00 |
2023-09-23 14:12:19 +00:00
| utime | Time of file upload: RFC 3339 | 2006-01-02T15:04:05.999999999Z07:00 |
2022-05-24 10:00:00 +00:00
| cache-control | Cache-Control header | no-cache |
| content-disposition | Content-Disposition header | inline |
| content-encoding | Content-Encoding header | gzip |
| content-language | Content-Language header | en-US |
| content-type | Content-Type header | text/plain |
The metadata keys `mtime` and `content-type` will take precedence if
supplied in the metadata over reading the `Content-Type` or
modification time of the source object.
Hashes are not included in system metadata as there is a well defined
way of reading those already.
2015-06-06 09:05:21 +00:00
Options
2014-03-28 22:34:13 +00:00
-------
2015-06-06 09:05:21 +00:00
Rclone has a number of options to control its behaviour.
2014-03-28 22:34:13 +00:00
2018-12-29 17:34:58 +00:00
Options that take parameters can have the values passed in two ways,
`--option=value` or `--option value` . However boolean (true/false)
options behave slightly differently to the other options in that
`--boolean` sets the option to `true` and the absence of the flag sets
it to `false` . It is also possible to specify `--boolean=false` or
`--boolean=true` . Note that `--boolean false` is not valid - this is
parsed as `--boolean` and the `false` is parsed as an extra command
line argument for rclone.
2022-07-26 16:53:35 +00:00
### Time or duration options {#time-option}
TIME or DURATION options can be specified as a duration string or a
time string.
A duration string is a possibly signed sequence of decimal numbers,
each with optional fraction and a unit suffix, such as "300ms",
"-1.5h" or "2h45m". Default units are seconds or the following
abbreviations are valid:
* `ms` - Milliseconds
* `s` - Seconds
* `m` - Minutes
* `h` - Hours
* `d` - Days
* `w` - Weeks
* `M` - Months
* `y` - Years
These can also be specified as an absolute time in the following
formats:
- RFC3339 - e.g. `2006-01-02T15:04:05Z` or `2006-01-02T15:04:05+07:00`
- ISO8601 Date and time, local timezone - `2006-01-02T15:04:05`
- ISO8601 Date and time, local timezone - `2006-01-02 15:04:05`
- ISO8601 Date - `2006-01-02` (YYYY-MM-DD)
### Size options {#size-option}
2014-03-28 22:34:13 +00:00
2021-08-21 17:54:21 +00:00
Options which use SIZE use KiB (multiples of 1024 bytes) by default.
However, a suffix of `B` for Byte, `K` for KiB, `M` for MiB,
`G` for GiB, `T` for TiB and `P` for PiB may be used. These are
2021-03-02 19:11:57 +00:00
the binary units, e.g. 1, 2\*\*10, 2\*\*20, 2\*\*30 respectively.
2014-03-28 22:34:13 +00:00
2017-01-10 21:47:03 +00:00
### --backup-dir=DIR ###
When using `sync` , `copy` or `move` any files which would have been
overwritten or deleted are moved in their original hierarchy into this
2017-01-19 17:26:29 +00:00
directory.
If `--suffix` is set, then the moved files will have the suffix added
to them. If there is a file with the same path (after the suffix has
been added) in DIR, then it will be overwritten.
2017-01-10 21:47:03 +00:00
2020-10-13 21:43:40 +00:00
The remote in use must support server-side move or copy and you must
2017-01-10 21:47:03 +00:00
use the same remote as the destination of the sync. The backup
2022-07-11 21:31:30 +00:00
directory must not overlap the destination directory without it being
excluded by a filter rule.
2017-01-10 21:47:03 +00:00
For example
2023-01-20 20:47:36 +00:00
rclone sync --interactive /path/to/local remote:current --backup-dir remote:old
2017-01-10 21:47:03 +00:00
will sync `/path/to/local` to `remote:current` , but for any files
which would have been updated or deleted will be stored in
`remote:old` .
2017-01-16 19:26:56 +00:00
If running rclone from a script you might want to use today's date as
2017-01-19 17:26:29 +00:00
the directory name passed to `--backup-dir` to store the old files, or
you might want to pass `--suffix` with today's date.
2017-01-16 19:26:56 +00:00
2019-07-08 01:02:53 +00:00
See `--compare-dest` and `--copy-dest` .
2017-07-23 15:10:23 +00:00
### --bind string ###
Local address to bind to for outgoing connections. This can be an
IPv4 address (1.2.3.4), an IPv6 address (1234::789A) or host name. If
2017-10-14 20:42:00 +00:00
the host name doesn't resolve or resolves to more than one IP address
2017-07-23 15:10:23 +00:00
it will give an error.
2023-08-30 22:41:36 +00:00
You can use `--bind 0.0.0.0` to force rclone to use IPv4 addresses and
`--bind ::0` to force rclone to use IPv6 addresses.
2017-01-03 02:52:41 +00:00
### --bwlimit=BANDWIDTH_SPEC ###
2014-03-28 22:34:13 +00:00
2020-12-07 16:19:20 +00:00
This option controls the bandwidth limit. For example
2017-01-03 02:52:41 +00:00
2020-12-07 16:19:20 +00:00
--bwlimit 10M
2021-11-04 11:50:43 +00:00
2021-08-21 17:54:21 +00:00
would mean limit the upload and download bandwidth to 10 MiB/s.
2020-12-07 16:19:20 +00:00
**NB** this is **bytes** per second not **bits** per second. To use a
2021-08-21 17:54:21 +00:00
single limit, specify the desired bandwidth in KiB/s, or use a
2021-03-02 19:11:57 +00:00
suffix B|K|M|G|T|P. The default is `0` which means to not limit bandwidth.
2014-03-28 22:34:13 +00:00
2022-08-14 02:56:32 +00:00
The upload and download bandwidth can be specified separately, as
2020-12-07 16:19:20 +00:00
`--bwlimit UP:DOWN` , so
2014-03-28 22:34:13 +00:00
2020-12-07 16:19:20 +00:00
--bwlimit 10M:100k
2021-08-21 17:54:21 +00:00
would mean limit the upload bandwidth to 10 MiB/s and the download
bandwidth to 100 KiB/s. Either limit can be "off" meaning no limit, so
2020-12-07 16:19:20 +00:00
to just limit the upload bandwidth you would use
--bwlimit 10M:off
2021-08-21 17:54:21 +00:00
this would limit the upload bandwidth to 10 MiB/s but the download
2020-12-07 16:19:20 +00:00
bandwidth would be unlimited.
When specified as above the bandwidth limits last for the duration of
run of the rclone binary.
It is also possible to specify a "timetable" of limits, which will
cause certain limits to be applied at certain times. To specify a
timetable, format your entries as `WEEKDAY-HH:MM,BANDWIDTH
WEEKDAY-HH:MM,BANDWIDTH...` where: `WEEKDAY` is optional element.
- `BANDWIDTH` can be a single number, e.g.`100k` or a pair of numbers
for upload:download, e.g.`10M:1M`.
- `WEEKDAY` can be written as the whole word or only using the first 3
characters. It is optional.
- `HH:MM` is an hour from 00:00 to 23:59.
2017-01-03 02:52:41 +00:00
2024-07-17 10:04:01 +00:00
Entries can be separated by spaces or semicolons.
**Note:** Semicolons can be used as separators instead of spaces to avoid parsing issues in environments like Docker.
2017-01-03 02:52:41 +00:00
An example of a typical timetable to avoid link saturation during daytime
working hours could be:
2024-07-17 10:04:01 +00:00
Using spaces as separators:
2020-12-07 16:19:20 +00:00
`--bwlimit "08:00,512k 12:00,10M 13:00,512k 18:00,30M 23:00,off"`
2017-01-03 02:52:41 +00:00
2024-07-17 10:04:01 +00:00
Using semicolons as separators:
`--bwlimit "08:00,512k;12:00,10M;13:00,512k;18:00,30M;23:00,off"`
In these examples, the transfer bandwidth will be set to 512 KiB/s
2021-08-21 17:54:21 +00:00
at 8am every day. At noon, it will rise to 10 MiB/s, and drop back
to 512 KiB/sec at 1pm. At 6pm, the bandwidth limit will be set to
30 MiB/s, and at 11pm it will be completely disabled (full speed).
2020-12-07 16:19:20 +00:00
Anything between 11pm and 8am will remain unlimited.
2017-01-03 02:52:41 +00:00
2020-05-25 06:35:04 +00:00
An example of timetable with `WEEKDAY` could be:
2018-06-17 17:38:09 +00:00
2024-07-17 10:04:01 +00:00
Using spaces as separators:
2018-06-17 17:38:09 +00:00
`--bwlimit "Mon-00:00,512 Fri-23:59,10M Sat-10:00,1M Sun-20:00,off"`
2024-07-17 10:04:01 +00:00
Using semicolons as separators:
`--bwlimit "Mon-00:00,512;Fri-23:59,10M;Sat-10:00,1M;Sun-20:00,off"`
2021-08-21 17:54:21 +00:00
It means that, the transfer bandwidth will be set to 512 KiB/s on
Monday. It will rise to 10 MiB/s before the end of Friday. At 10:00
on Saturday it will be set to 1 MiB/s. From 20:00 on Sunday it will
2020-12-07 16:19:20 +00:00
be unlimited.
2018-06-17 17:38:09 +00:00
2020-12-07 16:19:20 +00:00
Timeslots without `WEEKDAY` are extended to the whole week. So this
example:
2018-06-17 17:38:09 +00:00
`--bwlimit "Mon-00:00,512 12:00,1M Sun-20:00,off"`
2020-12-07 16:19:20 +00:00
Is equivalent to this:
2018-06-17 17:38:09 +00:00
`--bwlimit "Mon-00:00,512Mon-12:00,1M Tue-12:00,1M Wed-12:00,1M Thu-12:00,1M Fri-12:00,1M Sat-12:00,1M Sun-12:00,1M Sun-20:00,off"`
2020-12-07 16:19:20 +00:00
Bandwidth limit apply to the data transfer for all backends. For most
backends the directory listing bandwidth is also included (exceptions
2022-02-04 17:58:04 +00:00
being the non HTTP backends, `ftp` , `sftp` and `storj` ).
2014-03-28 22:34:13 +00:00
2021-04-07 10:23:42 +00:00
Note that the units are **Byte/s** , not **bit/s** . Typically
connections are measured in bit/s - to convert divide by 8. For
2020-12-07 16:19:20 +00:00
example, let's say you have a 10 Mbit/s connection and you wish rclone
2021-08-21 17:54:21 +00:00
to use half of it - 5 Mbit/s. This is 5/8 = 0.625 MiB/s so you would
2020-12-07 16:19:20 +00:00
use a `--bwlimit 0.625M` parameter for rclone.
2016-10-14 08:24:50 +00:00
2020-05-20 10:54:33 +00:00
On Unix systems (Linux, macOS, …) the bandwidth limiter can be toggled by
2017-07-22 08:49:45 +00:00
sending a `SIGUSR2` signal to rclone. This allows to remove the limitations
of a long running rclone transfer and to restore it back to the value specified
with `--bwlimit` quickly when needed. Assuming there is only one rclone instance
running, you can toggle the limiter like this:
kill -SIGUSR2 $(pidof rclone)
2018-03-16 21:45:09 +00:00
If you configure rclone with a [remote control ](/rc ) then you can use
change the bwlimit dynamically:
rclone rc core/bwlimit rate=1M
2020-06-20 15:10:02 +00:00
### --bwlimit-file=BANDWIDTH_SPEC ###
This option controls per file bandwidth limit. For the options see the
`--bwlimit` flag.
2021-08-21 17:54:21 +00:00
For example use this to allow no transfers to be faster than 1 MiB/s
2020-06-20 15:10:02 +00:00
--bwlimit-file 1M
This can be used in conjunction with `--bwlimit` .
Note that if a schedule is provided the file will use the schedule in
effect at the start of the transfer.
2017-02-14 19:31:33 +00:00
### --buffer-size=SIZE ###
Use this sized buffer to speed up file transfers. Each `--transfer`
will use this much memory for buffering.
2018-08-15 11:23:57 +00:00
When using `mount` or `cmount` each open file descriptor will use this much
memory for buffering.
See the [mount ](/commands/rclone_mount/#file-buffering ) documentation for more details.
2020-05-25 06:35:04 +00:00
Set to `0` to disable the buffering for the minimum memory usage.
2017-02-14 19:31:33 +00:00
2018-05-22 13:48:23 +00:00
Note that the memory allocation of the buffers is influenced by the
[--use-mmap ](#use-mmap ) flag.
2021-09-09 19:54:08 +00:00
### --cache-dir=DIR ###
Specify the directory rclone will use for caching, to override
the default.
Default value is depending on operating system:
- Windows `%LocalAppData%\rclone` , if `LocalAppData` is defined.
- macOS `$HOME/Library/Caches/rclone` if `HOME` is defined.
- Unix `$XDG_CACHE_HOME/rclone` if `XDG_CACHE_HOME` is defined, else `$HOME/.cache/rclone` if `HOME` is defined.
- Fallback (on all OS) to `$TMPDIR/rclone` , where `TMPDIR` is the value from [--temp-dir ](#temp-dir-dir ).
You can use the [config paths ](/commands/rclone_config_paths/ )
command to see the current value.
Cache directory is heavily used by the [VFS File Caching ](/commands/rclone_mount/#vfs-file-caching )
mount feature, but also by [serve ](/commands/rclone_serve/ ), [GUI ](/gui ) and other parts of rclone.
2020-05-15 10:39:07 +00:00
### --check-first ###
If this flag is set then in a `sync` , `copy` or `move` , rclone will do
all the checks to see whether files need to be transferred before
doing any of the transfers. Normally rclone would start running
transfers as soon as possible.
This flag can be useful on IO limited systems where transfers
interfere with checking.
2021-01-26 12:11:51 +00:00
It can also be useful to ensure perfect ordering when using
`--order-by` .
2023-03-08 13:03:05 +00:00
If both `--check-first` and `--order-by` are set when doing `rclone move`
then rclone will use the transfer thread to delete source files which
don't need transferring. This will enable perfect ordering of the
transfers and deletes but will cause the transfer stats to have more
items in than expected.
2020-05-15 10:39:07 +00:00
Using this flag can use more memory as it effectively sets
`--max-backlog` to infinite. This means that all the info on the
objects to transfer is held in memory before the transfers start.
2015-06-06 09:05:21 +00:00
### --checkers=N ###
2022-06-27 18:33:07 +00:00
Originally controlling just the number of file checkers to run in parallel,
e.g. by `rclone copy` . Now a fairly universal parallelism control
used by `rclone` in several places.
Note: checkers do the equality checking of files during a sync.
For some storage systems (e.g. S3, Swift, Dropbox) this can take
a significant amount of time so they are run in parallel.
The default is to run 8 checkers in parallel. However, in case
of slow-reacting backends you may need to lower (rather than increase)
this default by setting `--checkers` to 4 or less threads. This is
especially advised if you are experiencing backend server crashes
during file checking phase (e.g. on subsequent or top-up backups
where little or no file copying is done and checking takes up
most of the time). Increase this setting only with utmost care,
while monitoring your server health and file checking throughput.
2015-06-06 09:05:21 +00:00
### -c, --checksum ###
Normally rclone will look at modification time and size of files to
see if they are equal. If you set this flag then rclone will check
2016-01-13 10:29:43 +00:00
the file hash and size to determine if files are equal.
This is useful when the remote doesn't support setting modified time
and a more accurate sync is desired than just checking the file size.
2015-06-06 09:05:21 +00:00
This is very useful when transferring between remotes which store the
2020-10-13 21:49:58 +00:00
same hash type on the object, e.g. Drive and Swift. For details of which
2016-01-13 10:29:43 +00:00
remotes support which hash type see the table in the [overview
section](/overview/).
2015-06-06 09:05:21 +00:00
Eg `rclone --checksum sync s3:/bucket swift:/bucket` would run much
quicker than without the `--checksum` flag.
When using this flag, rclone won't update mtimes of remote files if
they are incorrect as it would normally.
2022-12-06 12:07:06 +00:00
### --color WHEN ###
2023-03-24 13:31:39 +00:00
Specify when colors (and other ANSI codes) should be added to the output.
2022-12-06 12:07:06 +00:00
`AUTO` (default) only allows ANSI codes when the output is a terminal
`NEVER` never allow ANSI codes
`ALWAYS` always add ANSI codes, regardless of the output format (terminal or file)
2019-07-08 01:02:53 +00:00
### --compare-dest=DIR ###
2021-11-04 11:50:43 +00:00
When using `sync` , `copy` or `move` DIR is checked in addition to the
destination for files. If a file identical to the source is found that
file is NOT copied from source. This is useful to copy just files that
2019-07-08 01:02:53 +00:00
have changed since the last backup.
2021-11-04 11:50:43 +00:00
You must use the same remote as the destination of the sync. The
2019-07-08 01:02:53 +00:00
compare directory must not overlap the destination directory.
See `--copy-dest` and `--backup-dir` .
2015-06-06 09:05:21 +00:00
### --config=CONFIG_FILE ###
2021-04-09 18:36:25 +00:00
Specify the location of the rclone configuration file, to override
the default. E.g. `rclone config --config="rclone.conf"` .
2017-01-14 03:47:55 +00:00
2021-04-09 18:36:25 +00:00
The exact default is a bit complex to describe, due to changes
introduced through different versions of rclone while preserving
backwards compatibility, but in most cases it is as simple as:
2019-06-03 19:14:32 +00:00
2021-04-09 18:36:25 +00:00
- `%APPDATA%/rclone/rclone.conf` on Windows
- `~/.config/rclone/rclone.conf` on other
The complete logic is as follows: Rclone will look for an existing
configuration file in any of the following locations, in priority order:
1. `rclone.conf` (in program directory, where rclone executable is)
2. `%APPDATA%/rclone/rclone.conf` (only on Windows)
3. `$XDG_CONFIG_HOME/rclone/rclone.conf` (on all systems, including Windows)
4. `~/.config/rclone/rclone.conf` (see below for explanation of ~ symbol)
5. `~/.rclone.conf`
If no existing configuration file is found, then a new one will be created
in the following location:
- On Windows: Location 2 listed above, except in the unlikely event
that `APPDATA` is not defined, then location 4 is used instead.
- On Unix: Location 3 if `XDG_CONFIG_HOME` is defined, else location 4.
- Fallback to location 5 (on all OS), when the rclone directory cannot be
created, but if also a home directory was not found then path
`.rclone.conf` relative to current working directory will be used as
a final resort.
The `~` symbol in paths above represent the home directory of the current user
on any OS, and the value is defined as following:
- On Windows: `%HOME%` if defined, else `%USERPROFILE%` , or else `%HOMEDRIVE%\%HOMEPATH%` .
- On Unix: `$HOME` if defined, else by looking up current user in OS-specific user database
(e.g. passwd file), or else use the result from shell command `cd && pwd` .
2017-01-14 03:47:55 +00:00
2019-01-13 17:56:57 +00:00
If you run `rclone config file` you will see where the default
location is for you.
2017-01-14 03:47:55 +00:00
2021-04-09 18:36:25 +00:00
The fact that an existing file `rclone.conf` in the same directory
as the rclone executable is always preferred, means that it is easy
to run in "portable" mode by downloading rclone executable to a
writable directory and then create an empty file `rclone.conf` in the
same directory.
2015-06-06 09:05:21 +00:00
2021-04-17 22:09:03 +00:00
If the location is set to empty string `""` or path to a file
with name `notfound` , or the os null device represented by value `NUL` on
2021-03-27 16:26:01 +00:00
Windows and `/dev/null` on Unix systems, then rclone will keep the
config file in memory only.
The file format is basic [INI ](https://en.wikipedia.org/wiki/INI_file#Format ):
Sections of text, led by a `[section]` header and followed by
`key=value` entries on separate lines. In rclone each remote is
represented by its own section, where the section name defines the
name of the remote. Options are specified as the `key=value` entries,
where the key is the option name without the `--backend-` prefix,
in lowercase and with `_` instead of `-` . E.g. option `--mega-hard-delete`
corresponds to key `hard_delete` . Only backend options can be specified.
A special, and required, key `type` identifies the [storage system ](/overview/ ),
where the value is the internal lowercase name as returned by command
`rclone help backends` . Comments are indicated by `;` or `#` at the
beginning of a line.
Example:
[megaremote]
type = mega
user = you@example.com
pass = PDPcQVVjVtzFY-GTdDFozqBhTdsPg3qH
Note that passwords are in [obscured ](/commands/rclone_obscure/ )
form. Also, many storage systems uses token-based authentication instead
of passwords, and this requires additional steps. It is easier, and safer,
to use the interactive command `rclone config` instead of manually
editing the configuration file.
The configuration file will typically contain login information, and
should therefore have restricted permissions so that only the current user
can read it. Rclone tries to ensure this when it writes the file.
You may also choose to [encrypt ](#configuration-encryption ) the file.
When token-based authentication are used, the configuration file
must be writable, because rclone needs to update the tokens inside it.
2021-03-13 12:36:38 +00:00
2022-08-28 15:55:55 +00:00
To reduce risk of corrupting an existing configuration file, rclone
will not write directly to it when saving changes. Instead it will
first write to a new, temporary, file. If a configuration file already
existed, it will (on Unix systems) try to mirror its permissions to
2023-04-04 12:20:40 +00:00
the new file. Then it will rename the existing file to a temporary
name as backup. Next, rclone will rename the new file to the correct name,
before finally cleaning up by deleting the backup file.
2022-08-28 15:55:55 +00:00
2023-04-04 12:35:53 +00:00
If the configuration file path used by rclone is a symbolic link, then
this will be evaluated and rclone will write to the resolved path, instead
of overwriting the symbolic link. Temporary files used in the process
(described above) will be written to the same parent directory as that
of the resolved configuration file, but if this directory is also a
symbolic link it will not be resolved and the temporary files will be
written to the location of the directory symbolic link.
2015-06-06 09:05:21 +00:00
### --contimeout=TIME ###
Set the connection timeout. This should be in go time format which
looks like `5s` for 5 seconds, `10m` for 10 minutes, or `3h30m` .
The connection timeout is the amount of time rclone will wait for a
connection to go through to a remote object storage system. It is
`1m` by default.
2019-07-08 01:02:53 +00:00
### --copy-dest=DIR ###
2021-11-04 11:50:43 +00:00
When using `sync` , `copy` or `move` DIR is checked in addition to the
destination for files. If a file identical to the source is found that
file is server-side copied from DIR to the destination. This is useful
2019-07-08 01:02:53 +00:00
for incremental backup.
2020-10-13 21:43:40 +00:00
The remote in use must support server-side copy and you must
2019-07-08 01:02:53 +00:00
use the same remote as the destination of the sync. The compare
directory must not overlap the destination directory.
See `--compare-dest` and `--backup-dir` .
2016-03-05 16:10:51 +00:00
### --dedupe-mode MODE ###
2022-06-01 18:00:43 +00:00
Mode to run dedupe command in. One of `interactive` , `skip` , `first` ,
`newest` , `oldest` , `rename` . The default is `interactive` .
See the dedupe command for more information as to what these options mean.
2016-03-05 16:10:51 +00:00
2023-05-03 09:39:42 +00:00
### --default-time TIME ###
If a file or directory does have a modification time rclone can read
then rclone will display this fixed time instead.
The default is `2000-01-01 00:00:00 UTC` . This can be configured in
any of the ways shown in [the time or duration options ](#time-option ).
For example `--default-time 2020-06-01` to set the default time to the
1st of June 2020 or `--default-time 0s` to set the default time to the
time rclone started up.
2017-08-07 20:10:03 +00:00
### --disable FEATURE,FEATURE,... ###
This disables a comma separated list of optional features. For example
2020-10-13 21:43:40 +00:00
to disable server-side move and server-side copy use:
2017-08-07 20:10:03 +00:00
--disable move,copy
2020-05-19 11:02:44 +00:00
The features can be put in any case.
2017-08-07 20:10:03 +00:00
To see a list of which features can be disabled use:
--disable help
2023-03-14 15:59:44 +00:00
The features a remote has can be seen in JSON format with:
rclone backend features remote:
2017-08-07 20:10:03 +00:00
See the overview [features ](/overview/#features ) and
[optional features ](/overview/#optional-features ) to get an idea of
which feature does what.
2023-03-14 15:59:44 +00:00
Note that some features can be set to `true` if they are `true` /`false`
feature flag features by prefixing them with `!` . For example the
`CaseInsensitive` feature can be forced to `false` with `--disable CaseInsensitive`
and forced to `true` with `--disable '!CaseInsensitive'` . In general
it isn't a good idea doing this but it may be useful in extremis.
(Note that `!` is a shell command which you will
need to escape with single quotes or a backslash on unix like
platforms.)
2017-08-07 20:10:03 +00:00
This flag can be useful for debugging and in exceptional circumstances
2020-10-13 21:49:58 +00:00
(e.g. Google Drive limiting the total volume of Server Side Copies to
2021-03-02 19:11:57 +00:00
100 GiB/day).
2017-08-07 20:10:03 +00:00
2022-02-04 10:57:53 +00:00
### --disable-http2
This stops rclone from trying to use HTTP/2 if available. This can
sometimes speed up transfers due to a
[problem in the Go standard library ](https://github.com/golang/go/issues/37373 ).
2021-01-29 03:41:50 +00:00
### --dscp VALUE ###
Specify a DSCP value or name to use in connections. This could help QoS
system to identify traffic class. BE, EF, DF, LE, CSx and AFxx are allowed.
See the description of [differentiated services ](https://en.wikipedia.org/wiki/Differentiated_services ) to get an idea of
this field. Setting this to 1 (LE) to identify the flow to SCAVENGER class
can avoid occupying too much bandwidth in a network with DiffServ support ([RFC 8622](https://tools.ietf.org/html/rfc8622)).
For example, if you configured QoS on router to handle LE properly. Running:
```
rclone copy --dscp LE from:/from to:/to
```
would make the priority lower than usual internet flows.
2021-05-22 19:56:45 +00:00
This option has no effect on Windows (see [golang/go#42728 ](https://github.com/golang/go/issues/42728 )).
2015-06-06 09:05:21 +00:00
### -n, --dry-run ###
2016-01-31 15:53:09 +00:00
Do a trial run with no permanent changes. Use this to see what rclone
would do without actually doing it. Useful when setting up the `sync`
command which deletes files in the destination.
2015-06-06 09:05:21 +00:00
2020-01-09 14:00:46 +00:00
### --expect-continue-timeout=TIME ###
This specifies the amount of time to wait for a server's first
response headers after fully writing the request headers if the
request has an "Expect: 100-continue" header. Not all backends support
using this.
Zero means no timeout and causes the body to be sent immediately,
without waiting for the server to approve. This time does not include
the time to send the request header.
2020-05-25 06:35:04 +00:00
The default is `1s` . Set to `0` to disable.
2020-01-09 14:00:46 +00:00
2019-12-18 11:52:20 +00:00
### --error-on-no-transfer ###
By default, rclone will exit with return code 0 if there were no errors.
This option allows rclone to return exit code 9 if no files were transferred
between the source and destination. This allows using rclone in scripts, and
triggering follow-on actions if data was copied, or skipping if not.
NB: Enabling this option turns a usually non-fatal error into a potentially
fatal one - please check and adjust your scripts accordingly!
2023-10-09 02:59:22 +00:00
### --fix-case ###
Normally, a sync to a case insensitive dest (such as macOS / Windows) will
not result in a matching filename if the source and dest filenames have
casing differences but are otherwise identical. For example, syncing `hello.txt`
to `HELLO.txt` will normally result in the dest filename remaining `HELLO.txt` .
If `--fix-case` is set, then `HELLO.txt` will be renamed to `hello.txt`
to match the source.
NB:
- directory names with incorrect casing will also be fixed
- `--fix-case` will be ignored if `--immutable` is set
- using `--local-case-sensitive` instead is not advisable;
it will cause `HELLO.txt` to get deleted!
- the old dest filename must not be excluded by filters.
Be especially careful with [`--files-from` ](/filtering/#files-from-read-list-of-source-file-names ),
which does not respect [`--ignore-case` ](/filtering/#ignore-case-make-searches-case-insensitive )!
- on remotes that do not support server-side move, `--fix-case` will require
downloading the file and re-uploading it. To avoid this, do not use `--fix-case` .
2021-03-29 16:18:49 +00:00
### --fs-cache-expire-duration=TIME
When using rclone via the API rclone caches created remotes for 5
minutes by default in the "fs cache". This means that if you do
repeated actions on the same remote then rclone won't have to build it
again from scratch, which makes it more efficient.
This flag sets the time that the remotes are cached for. If you set it
to `0` (or negative) then rclone won't cache the remotes at all.
Note that if you use some flags, eg `--backup-dir` and if this is set
to `0` rclone may build two remotes (one for the source or destination
and one for the `--backup-dir` where it may have only built one
before.
### --fs-cache-expire-interval=TIME
This controls how often rclone checks for cached remotes to expire.
See the `--fs-cache-expire-duration` documentation above for more
info. The default is 60s, set to 0 to disable expiry.
2020-04-23 14:24:21 +00:00
### --header ###
Add an HTTP header for all transactions. The flag can be repeated to
add multiple headers.
If you want to add headers only for uploads use `--header-upload` and
if you want to add headers only for downloads use `--header-download` .
This flag is supported for all HTTP based backends even those not
supported by `--header-upload` and `--header-download` so may be used
as a workaround for those with care.
```
rclone ls remote:test --header "X-Rclone: Foo" --header "X-LetMeIn: Yes"
```
2020-04-16 14:20:27 +00:00
### --header-download ###
Add an HTTP header for all download transactions. The flag can be repeated to
add multiple headers.
```
2023-01-20 20:47:36 +00:00
rclone sync --interactive s3:test/src ~/dst --header-download "X-Amz-Meta-Test: Foo" --header-download "X-Amz-Meta-Test2: Bar"
2020-04-16 14:20:27 +00:00
```
2020-05-20 10:54:33 +00:00
See the GitHub issue [here ](https://github.com/rclone/rclone/issues/59 ) for
2020-04-16 14:20:27 +00:00
currently supported backends.
### --header-upload ###
Add an HTTP header for all upload transactions. The flag can be repeated to add
multiple headers.
```
2023-01-20 20:47:36 +00:00
rclone sync --interactive ~/src s3:test/dst --header-upload "Content-Disposition: attachment; filename='cool.html'" --header-upload "X-Amz-Meta-Test: FooBar"
2020-04-16 14:20:27 +00:00
```
2020-05-20 10:54:33 +00:00
See the GitHub issue [here ](https://github.com/rclone/rclone/issues/59 ) for
2020-04-16 14:20:27 +00:00
currently supported backends.
2019-12-18 11:52:20 +00:00
2021-08-31 11:11:20 +00:00
### --human-readable ###
Rclone commands output values for sizes (e.g. number of bytes) and
counts (e.g. number of files) either as *raw* numbers, or
in *human-readable* format.
In human-readable format the values are scaled to larger units, indicated with
a suffix shown after the value, and rounded to three decimals. Rclone consistently
uses binary units (powers of 2) for sizes and decimal units (powers of 10) for counts.
The unit prefix for size is according to IEC standard notation, e.g. `Ki` for kibi.
Used with byte unit, `1 KiB` means 1024 Byte. In list type of output, only the
unit prefix appended to the value (e.g. `9.762Ki` ), while in more textual output
the full unit is shown (e.g. `9.762 KiB` ). For counts the SI standard notation is
used, e.g. prefix `k` for kilo. Used with file counts, `1k` means 1000 files.
2022-04-07 12:25:48 +00:00
The various [list ](/commands/rclone_ls/ ) commands output raw numbers by default.
2021-08-31 11:11:20 +00:00
Option `--human-readable` will make them output values in human-readable format
instead (with the short unit prefix).
2022-04-07 12:25:48 +00:00
The [about ](/commands/rclone_about/ ) command outputs human-readable by default,
2021-08-31 11:11:20 +00:00
with a command-specific option `--full` to output the raw numbers instead.
2022-04-07 12:25:48 +00:00
Command [size ](/commands/rclone_size/ ) outputs both human-readable and raw numbers
2021-08-31 11:11:20 +00:00
in the same output.
2022-04-07 12:25:48 +00:00
The [tree ](/commands/rclone_tree/ ) command also considers `--human-readable` , but
2021-08-31 11:11:20 +00:00
it will not use the exact same notation as the other commands: It rounds to one
decimal, and uses single letter suffix, e.g. `K` instead of `Ki` . The reason for
this is that it relies on an external library.
2022-04-07 12:25:48 +00:00
The interactive command [ncdu ](/commands/rclone_ncdu/ ) shows human-readable by
2021-08-31 11:11:20 +00:00
default, and responds to key `u` for toggling human-readable format.
2019-06-03 20:12:10 +00:00
### --ignore-case-sync ###
2021-11-04 11:50:43 +00:00
Using this option will cause rclone to ignore the case of the files
2019-06-03 20:12:10 +00:00
when synchronizing so files will not be copied/synced when the
existing filenames are the same, even if the casing is different.
2017-01-05 17:32:42 +00:00
### --ignore-checksum ###
Normally rclone will check that the checksums of transferred files
match, and give an error "corrupted on transfer" if they don't.
You can use this option to skip that check. You should only use it if
you have had the "corrupted on transfer" error message and you are
sure you might want to transfer potentially corrupted data.
2016-01-10 12:04:20 +00:00
### --ignore-existing ###
Using this option will make rclone unconditionally skip all files
that exist on the destination, no matter the content of these files.
While this isn't a generally recommended option, it can be useful
in cases where your files change due to encryption. However, it cannot
correct partial transfers in case a transfer was interrupted.
2021-07-29 16:42:55 +00:00
When performing a `move` /`moveto` command, this flag will leave skipped
files in the source location unchanged when a file with the same name
exists on the destination.
2016-06-17 16:20:08 +00:00
### --ignore-size ###
Normally rclone will look at modification time and size of files to
see if they are equal. If you set this flag then rclone will check
only the modification time. If `--checksum` is set then it only
checks the checksum.
It will also cause rclone to skip verifying the sizes are the same
after transfer.
2017-06-25 21:29:51 +00:00
This can be useful for transferring files to and from OneDrive which
2016-06-17 16:20:08 +00:00
occasionally misreports the size of image files (see
2019-07-28 17:47:38 +00:00
[#399 ](https://github.com/rclone/rclone/issues/399 ) for more info).
2016-06-17 16:20:08 +00:00
2016-03-22 17:02:27 +00:00
### -I, --ignore-times ###
Using this option will cause rclone to unconditionally upload all
files regardless of the state of files on the destination.
Normally rclone would skip any files that have the same
modification time and are the same size (or have the same checksum if
using `--checksum` ).
2017-09-02 08:29:01 +00:00
### --immutable ###
Treat source and destination files as immutable and disallow
modification.
With this option set, files will be created and deleted as requested,
but existing files will never be updated. If an existing file does
not match between the source and destination, rclone will give the error
`Source and destination exist but do not match: immutable file modified` .
Note that only commands which transfer files (e.g. `sync` , `copy` ,
`move` ) are affected by this behavior, and only modification is
disallowed. Files may still be deleted explicitly (e.g. `delete` ,
`purge` ) or implicitly (e.g. `sync` , `move` ). Use `copy --immutable`
if it is desired to avoid deletion as well as modification.
This can be useful as an additional layer of protection for immutable
or append-only data sets (notably backup archives), where modification
implies corruption and should not be propagated.
2023-04-04 15:19:16 +00:00
### --inplace {#inplace}
The `--inplace` flag changes the behaviour of rclone when uploading
files to some backends (backends with the `PartialUploads` feature
flag set) such as:
- local
- ftp
- sftp
2024-07-13 20:35:47 +00:00
- pcloud
2023-04-04 15:19:16 +00:00
Without `--inplace` (the default) rclone will first upload to a
2023-10-10 11:27:32 +00:00
temporary file with an extension like this, where `XXXXXX` represents a
2024-07-13 20:35:47 +00:00
hash of the source file's fingerprint and `.partial` is
[--partial-suffix ](#partial-suffix ) value (`.partial` by default).
2023-04-04 15:19:16 +00:00
original-file-name.XXXXXX.partial
(rclone will make sure the final name is no longer than 100 characters
by truncating the `original-file-name` part if necessary).
When the upload is complete, rclone will rename the `.partial` file to
the correct name, overwriting any existing file at that point. If the
upload fails then the `.partial` file will be deleted.
This prevents other users of the backend from seeing partially
uploaded files in their new names and prevents overwriting the old
file until the new one is completely uploaded.
If the `--inplace` flag is supplied, rclone will upload directly to
the final name without creating a `.partial` file.
This means that an incomplete file will be visible in the directory
listings while the upload is in progress and any existing files will
be overwritten as soon as the upload starts. If the transfer fails
then the file will be deleted. This can cause data loss of the
existing file if the transfer fails.
Note that on the local file system if you don't use `--inplace` hard
links (Unix only) will be broken. And if you do use `--inplace` you
won't be able to update in use executables.
Note also that versions of rclone prior to v1.63.0 behave as if the
`--inplace` flag is always supplied.
2023-01-20 20:47:36 +00:00
### -i, --interactive {#interactive}
2020-06-05 15:13:10 +00:00
This flag can be used to tell rclone that you wish a manual
confirmation before destructive operations.
It is **recommended** that you use this flag while learning rclone
especially with `rclone sync` .
For example
```
2023-01-20 20:47:36 +00:00
$ rclone delete --interactive /tmp/dir
2020-06-05 15:13:10 +00:00
rclone: delete "important-file.txt"?
y) Yes, this is OK (default)
n) No, skip this
s) Skip all delete operations with no more questions
!) Do all delete operations with no more questions
q) Exit rclone now.
y/n/s/!/q> n
```
The options mean
- `y` : **Yes** , this operation should go ahead. You can also press Return
for this to happen. You'll be asked every time unless you choose `s`
or `!` .
- `n` : **No** , do not do this operation. You'll be asked every time unless
you choose `s` or `!` .
- `s` : **Skip** all the following operations of this type with no more
questions. This takes effect until rclone exits. If there are any
different kind of operations you'll be prompted for them.
- `!` : **Do all** the following operations with no more
questions. Useful if you've decided that you don't mind rclone doing
that kind of operation. This takes effect until rclone exits . If
there are any different kind of operations you'll be prompted for
them.
- `q` : **Quit** rclone now, just in case!
### --leave-root ####
2017-12-13 10:23:54 +00:00
During rmdirs it will not remove root directory, even if it's empty.
2015-06-06 09:05:21 +00:00
### --log-file=FILE ###
Log all of rclone's output to FILE. This is not active by default.
This can be useful for tracking down problems with syncs in
2017-06-26 21:46:45 +00:00
combination with the `-v` flag. See the [Logging section ](#logging )
for more info.
2015-06-06 09:05:21 +00:00
2020-09-08 15:13:33 +00:00
If FILE exists then rclone will append to it.
2018-04-26 14:30:46 +00:00
Note that if you are using the `logrotate` program to manage rclone's
logs, then you should use the `copytruncate` option as rclone doesn't
have a signal to rotate logs.
2018-09-02 17:11:09 +00:00
### --log-format LIST ###
2022-06-01 18:00:43 +00:00
Comma separated list of log format options. Accepted options are `date` ,
`time` , `microseconds` , `pid` , `longfile` , `shortfile` , `UTC` . Any other
keywords will be silently ignored. `pid` will tag log messages with process
identifier which useful with `rclone mount --daemon` . Other accepted
options are explained in the [go documentation ](https://pkg.go.dev/log#pkg-constants ).
The default log format is "`date`,`time`".
2018-09-02 17:11:09 +00:00
2017-02-09 21:22:46 +00:00
### --log-level LEVEL ###
2017-10-19 15:19:44 +00:00
This sets the log level for rclone. The default log level is `NOTICE` .
2017-02-09 21:22:46 +00:00
`DEBUG` is equivalent to `-vv` . It outputs lots of debug info - useful
for bug reports and really finding out what rclone is doing.
`INFO` is equivalent to `-v` . It outputs information about each transfer
and prints stats once a minute by default.
`NOTICE` is the default log level if no logging flags are supplied. It
outputs very little when things are working normally. It outputs
warnings and significant events.
2017-06-25 21:29:51 +00:00
`ERROR` is equivalent to `-q` . It only outputs error messages.
2017-02-09 21:22:46 +00:00
2019-07-26 00:54:09 +00:00
### --use-json-log ###
2021-11-04 11:50:43 +00:00
This switches the log format to JSON for rclone. The fields of json log
2019-07-26 00:54:09 +00:00
are level, msg, source, time.
2016-01-12 17:38:28 +00:00
### --low-level-retries NUMBER ###
This controls the number of low level retries rclone does.
A low level retry is used to retry a failing operation - typically one
HTTP request. This might be uploading a chunk of a big file for
example. You will see low level retries in the log with the `-v`
flag.
2017-06-25 21:29:51 +00:00
This shouldn't need to be changed from the default in normal operations.
However, if you get a lot of low level retries you may wish
2016-01-12 17:38:28 +00:00
to reduce the value so rclone moves on to a high level retry (see the
`--retries` flag) quicker.
Disable low level retries with `--low-level-retries 1` .
2018-07-19 21:41:34 +00:00
### --max-backlog=N ###
This is the maximum allowable backlog of files in a sync/copy/move
queued for being checked or transferred.
This can be set arbitrarily large. It will only use memory when the
2021-03-02 19:11:57 +00:00
queue is in use. Note that it will use in the order of N KiB of memory
2018-07-19 21:41:34 +00:00
when the backlog is in use.
Setting this large allows rclone to calculate how many files are
2019-11-28 17:01:21 +00:00
pending more accurately, give a more accurate estimated finish
time and make `--order-by` work more accurately.
2018-07-19 21:41:34 +00:00
Setting this small will make rclone more synchronous to the listings
of the remote which may be desirable.
2020-05-15 10:23:16 +00:00
Setting this to a negative number will make the backlog as large as
possible.
2018-02-12 10:48:12 +00:00
### --max-delete=N ###
This tells rclone not to delete more than N files. If that limit is
exceeded then a fatal error will be generated and rclone will stop the
operation in progress.
2022-08-03 14:53:02 +00:00
### --max-delete-size=SIZE ###
Rclone will stop deleting files when the total size of deletions has
reached the size specified. It defaults to off.
If that limit is exceeded then a fatal error will be generated and
rclone will stop the operation in progress.
2016-06-02 20:02:44 +00:00
### --max-depth=N ###
This modifies the recursion depth for all the commands except purge.
So if you do `rclone --max-depth 1 ls remote:path` you will see only
the files in the top level directory. Using `--max-depth 2` means you
will see all the files in first two directory levels and so on.
For historical reasons the `lsd` command defaults to using a
`--max-depth` of 1 - you can override this with the command line flag.
You can use this command to disable recursion (with `--max-depth 1` ).
Note that if you use this with `sync` and `--delete-excluded` the
files not recursed through are considered excluded and will be deleted
on the destination. Test first with `--dry-run` if you are not sure
what will happen.
2019-07-25 10:28:27 +00:00
### --max-duration=TIME ###
2023-07-15 16:41:13 +00:00
Rclone will stop transferring when it has run for the
2019-07-25 10:28:27 +00:00
duration specified.
Defaults to off.
2023-07-15 16:41:13 +00:00
When the limit is reached all transfers will stop immediately.
Use `--cutoff-mode` to modify this behaviour.
2019-07-25 10:28:27 +00:00
2023-07-15 16:41:13 +00:00
Rclone will exit with exit code 10 if the duration limit is reached.
2019-07-25 10:28:27 +00:00
2018-04-21 21:03:27 +00:00
### --max-transfer=SIZE ###
Rclone will stop transferring when it has reached the size specified.
Defaults to off.
When the limit is reached all transfers will stop immediately.
2023-07-15 16:41:13 +00:00
Use `--cutoff-mode` to modify this behaviour.
2018-04-21 21:03:27 +00:00
2018-05-03 14:04:30 +00:00
Rclone will exit with exit code 8 if the transfer limit is reached.
2020-02-25 17:03:21 +00:00
### --cutoff-mode=hard|soft|cautious ###
2019-10-30 19:23:17 +00:00
2023-07-15 16:41:13 +00:00
This modifies the behavior of `--max-transfer` and `--max-duration`
2020-02-25 17:03:21 +00:00
Defaults to `--cutoff-mode=hard` .
2019-10-30 19:23:17 +00:00
2020-05-19 11:02:44 +00:00
Specifying `--cutoff-mode=hard` will stop transferring immediately
2019-10-30 19:23:17 +00:00
when Rclone reaches the limit.
2020-05-19 11:02:44 +00:00
Specifying `--cutoff-mode=soft` will stop starting new transfers
2019-10-30 19:23:17 +00:00
when Rclone reaches the limit.
2020-05-19 11:02:44 +00:00
Specifying `--cutoff-mode=cautious` will try to prevent Rclone
2023-07-15 16:41:13 +00:00
from reaching the limit. Only applicable for `--max-transfer`
## -M, --metadata
Setting this flag enables rclone to copy the metadata from the source
to the destination. For local backends this is ownership, permissions,
2023-10-23 22:47:18 +00:00
xattr etc. See the [metadata section ](#metadata ) for more info.
### --metadata-mapper SpaceSepList {#metadata-mapper}
If you supply the parameter `--metadata-mapper /path/to/program` then
rclone will use that program to map metadata from source object to
destination object.
The argument to this flag should be a command with an optional space separated
list of arguments. If one of the arguments has a space in then enclose
it in `"` , if you want a literal `"` in an argument then enclose the
argument in `"` and double the `"` . See [CSV encoding ](https://godoc.org/encoding/csv )
for more info.
--metadata-mapper "python bin/test_metadata_mapper.py"
--metadata-mapper 'python bin/test_metadata_mapper.py "argument with a space"'
--metadata-mapper 'python bin/test_metadata_mapper.py "argument with ""two"" quotes"'
This uses a simple JSON based protocol with input on STDIN and output
on STDOUT. This will be called for every file and directory copied and
may be called concurrently.
The program's job is to take a metadata blob on the input and turn it
into a metadata blob on the output suitable for the destination
backend.
Input to the program (via STDIN) might look like this. This provides
some context for the `Metadata` which may be important.
- `SrcFs` is the config string for the remote that the object is currently on.
- `SrcFsType` is the name of the source backend.
- `DstFs` is the config string for the remote that the object is being copied to
- `DstFsType` is the name of the destination backend.
2024-02-06 16:00:34 +00:00
- `Remote` is the path of the object relative to the root.
- `Size` , `MimeType` , `ModTime` are attributes of the object.
2023-10-23 22:47:18 +00:00
- `IsDir` is `true` if this is a directory (not yet implemented).
2024-02-06 16:00:34 +00:00
- `ID` is the source `ID` of the object if known.
2023-10-23 22:47:18 +00:00
- `Metadata` is the backend specific metadata as described in the backend docs.
```json
{
"SrcFs": "gdrive:",
"SrcFsType": "drive",
"DstFs": "newdrive:user",
"DstFsType": "onedrive",
"Remote": "test.txt",
"Size": 6,
"MimeType": "text/plain; charset=utf-8",
"ModTime": "2022-10-11T17:53:10.286745272+01:00",
"IsDir": false,
"ID": "xyz",
"Metadata": {
"btime": "2022-10-11T16:53:11Z",
"content-type": "text/plain; charset=utf-8",
"mtime": "2022-10-11T17:53:10.286745272+01:00",
"owner": "user1@domain1.com",
"permissions": "...",
"description": "my nice file",
"starred": "false"
}
}
```
The program should then modify the input as desired and send it to
STDOUT. The returned `Metadata` field will be used in its entirety for
the destination object. Any other fields will be ignored. Note in this
example we translate user names and permissions and add something to
the description:
```json
{
"Metadata": {
"btime": "2022-10-11T16:53:11Z",
"content-type": "text/plain; charset=utf-8",
"mtime": "2022-10-11T17:53:10.286745272+01:00",
"owner": "user1@domain2.com",
"permissions": "...",
"description": "my nice file [migrated from domain1]",
"starred": "false"
}
}
```
Metadata can be removed here too.
An example python program might look something like this to implement
the above transformations.
```python
import sys, json
i = json.load(sys.stdin)
metadata = i["Metadata"]
# Add tag to description
if "description" in metadata:
metadata["description"] += " [migrated from domain1]"
else:
metadata["description"] = "[migrated from domain1]"
# Modify owner
if "owner" in metadata:
metadata["owner"] = metadata["owner"].replace("domain1.com", "domain2.com")
o = { "Metadata": metadata }
json.dump(o, sys.stdout, indent="\t")
```
You can find this example (slightly expanded) in the rclone source code at
2023-12-07 17:00:13 +00:00
[bin/test_metadata_mapper.py ](https://github.com/rclone/rclone/blob/master/bin/test_metadata_mapper.py ).
2023-10-23 22:47:18 +00:00
If you want to see the input to the metadata mapper and the output
returned from it in the log you can use `-vv --dump mapper` .
See the [metadata section ](#metadata ) for more info.
2023-07-15 16:41:13 +00:00
### --metadata-set key=value
Add metadata `key` = `value` when uploading. This can be repeated as
2023-10-23 22:47:18 +00:00
many times as required. See the [metadata section ](#metadata ) for more
2023-07-15 16:41:13 +00:00
info.
2019-10-30 19:23:17 +00:00
2015-06-06 09:05:21 +00:00
### --modify-window=TIME ###
When checking whether a file has been modified, this is the maximum
allowed time difference that a file can have and still be considered
equivalent.
The default is `1ns` unless this is overridden by a remote. For
example OS X only stores modification times to the nearest second so
if you are reading and writing to an OS X filing system this will be
`1s` by default.
This command line flag allows you to override that computed default.
2023-06-02 12:00:06 +00:00
### --multi-thread-write-buffer-size=SIZE ###
2023-09-01 16:25:15 +00:00
When transferring with multiple threads, rclone will buffer SIZE bytes
in memory before writing to disk for each thread.
2023-06-02 12:00:06 +00:00
This can improve performance if the underlying filesystem does not deal
well with a lot of small writes in different positions of the file, so
2023-09-01 16:25:15 +00:00
if you see transfers being limited by disk write speed, you might want
2023-06-02 12:00:06 +00:00
to experiment with different values. Specially for magnetic drives and
remote file systems a higher value can be useful.
Nevertheless, the default of `128k` should be fine for almost all use
cases, so before changing it ensure that network is not really your
bottleneck.
As a final hint, size is not the only factor: block size (or similar
concept) can have an impact. In one case, we observed that exact
multiples of 16k performed much better than other values.
2023-08-21 16:14:13 +00:00
### --multi-thread-chunk-size=SizeSuffix ###
2023-09-01 16:25:15 +00:00
Normally the chunk size for multi thread transfers is set by the backend.
However some backends such as `local` and `smb` (which implement `OpenWriterAt`
but not `OpenChunkWriter` ) don't have a natural chunk size.
2023-08-21 16:14:13 +00:00
In this case the value of this option is used (default 64Mi).
2023-09-11 14:59:44 +00:00
### --multi-thread-cutoff=SIZE {#multi-thread-cutoff}
2019-04-24 16:04:40 +00:00
2023-09-01 16:25:15 +00:00
When transferring files above SIZE to capable backends, rclone will
use multiple threads to transfer the file (default 256M).
2023-08-21 16:14:13 +00:00
Capable backends are marked in the
[overview ](/overview/#optional-features ) as `MultithreadUpload` . (They
2023-12-01 19:45:48 +00:00
need to implement either the `OpenWriterAt` or `OpenChunkWriter`
2023-09-01 16:25:15 +00:00
internal interfaces). These include include, `local` , `s3` ,
`azureblob` , `b2` , `oracleobjectstorage` and `smb` at the time of
writing.
2019-04-24 16:04:40 +00:00
2023-08-21 16:14:13 +00:00
On the local disk, rclone preallocates the file (using
`fallocate(FALLOC_FL_KEEP_SIZE)` on unix or `NTSetInformationFile` on
Windows both of which takes no time) then each thread writes directly
into the file at the correct place. This means that rclone won't
create fragmented or sparse files and there won't be any assembly time
at the end of the transfer.
2019-04-24 16:04:40 +00:00
2023-08-21 16:14:13 +00:00
The number of threads used to transfer is controlled by
2019-04-24 16:04:40 +00:00
`--multi-thread-streams` .
Use `-vv` if you wish to see info about the threads.
This will work with the `sync` /`copy`/`move` commands and friends
2023-08-21 16:14:13 +00:00
`copyto` /`moveto`. Multi thread transfers will be used with `rclone
2019-04-24 16:04:40 +00:00
mount` and `rclone serve` if `--vfs-cache-mode` is set to `writes` or
above.
2023-09-01 16:25:15 +00:00
**NB** that this **only** works with supported backends as the
destination but will work with any backend as the source.
2019-04-24 16:04:40 +00:00
2023-08-21 16:14:13 +00:00
**NB** that multi-thread copies are disabled for local to local copies
2019-08-12 21:09:40 +00:00
as they are faster without unless `--multi-thread-streams` is set
explicitly.
2023-08-21 16:14:13 +00:00
**NB** on Windows using multi-thread transfers to the local disk will
cause the resulting files to be [sparse ](https://en.wikipedia.org/wiki/Sparse_file ).
2020-05-19 09:16:43 +00:00
Use `--local-no-sparse` to disable sparse files (which may cause long
2023-09-01 16:25:15 +00:00
delays at the start of transfers) or disable multi-thread transfers
2020-05-19 09:16:43 +00:00
with `--multi-thread-streams 0`
2019-04-24 16:04:40 +00:00
### --multi-thread-streams=N ###
2023-09-01 16:25:15 +00:00
When using multi thread transfers (see above `--multi-thread-cutoff` )
2023-08-21 16:14:13 +00:00
this sets the number of streams to use. Set to `0` to disable multi
2023-09-01 16:25:15 +00:00
thread transfers (Default 4).
If the backend has a `--backend-upload-concurrency` setting (eg
`--s3-upload-concurrency` ) then this setting will be used as the
number of transfers instead if it is larger than the value of
`--multi-thread-streams` or `--multi-thread-streams` isn't set.
2019-04-24 16:04:40 +00:00
2019-10-17 16:41:11 +00:00
### --no-check-dest ###
The `--no-check-dest` can be used with `move` or `copy` and it causes
rclone not to check the destination at all when copying files.
This means that:
- the destination is not listed minimising the API calls
- files are always transferred
2020-10-13 21:49:58 +00:00
- this can cause duplicates on remotes which allow it (e.g. Google Drive)
2019-10-17 16:41:11 +00:00
- `--retries 1` is recommended otherwise you'll transfer everything again on a retry
This flag is useful to minimise the transactions if you know that none
of the files are on the destination.
This is a specialized flag which should be ignored by most users!
2016-02-14 18:14:41 +00:00
### --no-gzip-encoding ###
Don't set `Accept-Encoding: gzip` . This means that rclone won't ask
the server for compressed files automatically. Useful if you've set
the server to return files with `Content-Encoding: gzip` but you
uploaded compressed files.
There is no need to set this in normal operation, and doing so will
decrease the network transfer efficiency of rclone.
2019-02-11 13:26:14 +00:00
### --no-traverse ###
The `--no-traverse` flag controls whether the destination file system
is traversed when using the `copy` or `move` commands.
`--no-traverse` is not compatible with `sync` and will be ignored if
you supply it with `sync` .
If you are only copying a small number of files (or are filtering most
of the files) and/or have a large number of files on the destination
then `--no-traverse` will stop rclone listing the destination and save
time.
However, if you are copying a large number of files, especially if you
are doing a copy where lots of the files under consideration haven't
changed and won't need copying then you shouldn't use `--no-traverse` .
See [rclone copy ](/commands/rclone_copy/ ) for an example of how to use it.
2020-05-14 23:27:59 +00:00
### --no-unicode-normalization ###
Don't normalize unicode characters in filenames during the sync routine.
Sometimes, an operating system will store filenames containing unicode
parts in their decomposed form (particularly macOS). Some cloud storage
systems will then recompose the unicode, resulting in duplicate files if
the data is ever copied back to a local filesystem.
Using this flag will disable that functionality, treating each unicode
character as unique. For example, by default é and é will be normalized
into the same character. With `--no-unicode-normalization` they will be
treated as unique characters.
2016-07-12 09:46:45 +00:00
### --no-update-modtime ###
When using this flag, rclone won't update modification times of remote
files if they are incorrect as it would normally.
This can be used if the remote is being synced with another tool also
2020-10-13 21:49:58 +00:00
(e.g. the Google Drive client).
2016-07-12 09:46:45 +00:00
2024-03-07 16:13:36 +00:00
### --no-update-dir-modtime ###
When using this flag, rclone won't update modification times of remote
directories if they are incorrect as it would normally.
2019-11-28 17:01:21 +00:00
### --order-by string ###
The `--order-by` flag controls the order in which files in the backlog
are processed in `rclone sync` , `rclone copy` and `rclone move` .
The order by string is constructed like this. The first part
describes what aspect is being measured:
- `size` - order by the size of the files
- `name` - order by the full path of the files
- `modtime` - order by the modification date of the files
This can have a modifier appended with a comma:
- `ascending` or `asc` - order so that the smallest (or oldest) is processed first
- `descending` or `desc` - order so that the largest (or newest) is processed first
2020-03-13 21:12:22 +00:00
- `mixed` - order so that the smallest is processed first for some threads and the largest for others
If the modifier is `mixed` then it can have an optional percentage
2020-10-13 21:49:58 +00:00
(which defaults to `50` ), e.g. `size,mixed,25` which means that 25% of
2020-03-13 21:12:22 +00:00
the threads should be taking the smallest items and 75% the
largest. The threads which take the smallest first will always take
the smallest first and likewise the largest first threads. The `mixed`
mode can be useful to minimise the transfer time when you are
transferring a mixture of large and small files - the large files are
guaranteed upload threads and bandwidth and the small files will be
processed continuously.
2019-11-28 17:01:21 +00:00
If no modifier is supplied then the order is `ascending` .
For example
- `--order-by size,desc` - send the largest files first
- `--order-by modtime,ascending` - send the oldest files first
- `--order-by name` - send the files with alphabetically by path first
If the `--order-by` flag is not supplied or it is supplied with an
empty string then the default ordering will be used which is as
scanned. With `--checkers 1` this is mostly alphabetical, however
with the default `--checkers 8` it is somewhat random.
#### Limitations
The `--order-by` flag does not do a separate pass over the data. This
2020-01-16 15:18:12 +00:00
means that it may transfer some files out of the order specified if
2019-11-28 17:01:21 +00:00
- there are no files in the backlog or the source has not been fully scanned yet
- there are more than [--max-backlog ](#max-backlog-n ) files in the backlog
Rclone will do its best to transfer the best file it has so in
practice this should not cause a problem. Think of `--order-by` as
being more of a best efforts flag rather than a perfect ordering.
2021-01-26 12:11:51 +00:00
If you want perfect ordering then you will need to specify
[--check-first ](#check-first ) which will find all the files which need
transferring first before transferring any.
2023-10-10 11:27:32 +00:00
### --partial-suffix {#partial-suffix}
When [--inplace ](#inplace ) is not used, it causes rclone to use
the `--partial-suffix` as suffix for temporary files.
Suffix length limit is 16 characters.
The default is `.partial` .
2024-09-05 10:52:15 +00:00
### --password-command SpaceSepList {#password-command}
2020-01-23 13:54:18 +00:00
This flag supplies a program which should supply the config password
when run. This is an alternative to rclone prompting for the password
2024-07-23 16:13:28 +00:00
or setting the `RCLONE_CONFIG_PASS` variable. It is also used when
setting the config password for the first time.
2020-01-23 13:54:18 +00:00
2020-01-23 14:14:58 +00:00
The argument to this should be a command with a space separated list
of arguments. If one of the arguments has a space in then enclose it
in `"` , if you want a literal `"` in an argument then enclose the
argument in `"` and double the `"` . See [CSV encoding ](https://godoc.org/encoding/csv )
for more info.
Eg
2023-10-23 22:47:18 +00:00
--password-command "echo hello"
--password-command 'echo "hello with space"'
--password-command 'echo "hello with ""quotes"" and space"'
2020-01-23 14:14:58 +00:00
2024-09-05 10:52:15 +00:00
Note that when changing the configuration password the environment
variable `RCLONE_PASSWORD_CHANGE=1` will be set. This can be used to
distinguish initial decryption of the config file from the new
password.
2020-01-23 13:54:18 +00:00
See the [Configuration Encryption ](#configuration-encryption ) for more info.
2020-05-25 23:26:20 +00:00
See a [Windows PowerShell example on the Wiki ](https://github.com/rclone/rclone/wiki/Windows-Powershell-use-rclone-password-command-for-Config-file-password ).
2020-04-30 15:16:48 +00:00
2018-09-03 14:03:49 +00:00
### -P, --progress ###
2018-06-30 15:05:31 +00:00
This flag makes rclone update the stats in a static block in the
terminal providing a realtime overview of the transfer.
Any log messages will scroll above the static block. Log messages
will push the static block down to the bottom of the terminal where it
will stay.
Normally this is updated every 500mS but this period can be overridden
with the `--stats` flag.
This can be used with the `--stats-one-line` flag for a simpler
display.
2024-06-11 16:19:37 +00:00
To change the display length of filenames (for different terminal widths),
see the `--stats-file-name-length` option. The default output is formatted
for 80 character wide terminals.
2020-01-26 19:59:42 +00:00
Note: On Windows until [this bug ](https://github.com/Azure/go-ansiterm/issues/26 )
2018-09-14 11:01:52 +00:00
is fixed all non-ASCII characters will be replaced with `.` when
`--progress` is in use.
2020-10-06 15:34:26 +00:00
### --progress-terminal-title ###
This flag, when used with `-P/--progress` , will print the string `ETA: %s`
to the terminal title.
2015-06-06 09:05:21 +00:00
### -q, --quiet ###
2020-04-15 21:50:18 +00:00
This flag will limit rclone's output to error messages only.
2015-06-06 09:05:21 +00:00
2020-06-16 15:24:54 +00:00
### --refresh-times ###
The `--refresh-times` flag can be used to update modification times of
existing files when they are out of sync on backends which don't
support hashes.
This is useful if you uploaded files with the incorrect timestamps and
you now wish to correct them.
This flag is **only** useful for destinations which don't support
2020-10-13 21:49:58 +00:00
hashes (e.g. `crypt` ).
2020-06-16 15:24:54 +00:00
This can be used any of the sync commands `sync` , `copy` or `move` .
To use this flag you will need to be doing a modification time sync
(so not using `--size-only` or `--checksum` ). The flag will have no
effect when using `--size-only` or `--checksum` .
If this flag is used when rclone comes to upload a file it will check
to see if there is an existing file on the destination. If this file
matches the source with size (and checksum if available) but has a
differing timestamp then instead of re-uploading it, rclone will
update the timestamp on the destination file. If the checksum does not
2020-10-13 21:49:58 +00:00
match rclone will upload the new file. If the checksum is absent (e.g.
2020-06-16 15:24:54 +00:00
on a `crypt` backend) then rclone will update the timestamp.
Note that some remotes can't set the modification time without
re-uploading the file so this flag is less useful on them.
Normally if you are doing a modification time sync rclone will update
modification times without `--refresh-times` provided that the remote
supports checksums **and** the checksums match on the file. However if the
checksums are absent then rclone will upload the file rather than
setting the timestamp as this is the safe behaviour.
2016-01-10 12:04:20 +00:00
### --retries int ###
Retry the entire sync if it fails this many times it fails (default 3).
2017-06-25 21:29:51 +00:00
Some remotes can be unreliable and a few retries help pick up the
2016-01-10 12:04:20 +00:00
files which didn't get transferred because of errors.
Disable retries with `--retries 1` .
2018-06-08 15:12:24 +00:00
### --retries-sleep=TIME ###
2021-11-04 11:50:43 +00:00
This sets the interval between each retry specified by `--retries`
2018-06-08 15:12:24 +00:00
2020-05-25 06:35:04 +00:00
The default is `0` . Use `0` to disable.
2018-06-08 15:12:24 +00:00
2022-07-04 15:26:08 +00:00
### --server-side-across-configs ###
Allow server-side operations (e.g. copy or move) to work across
different configurations.
This can be useful if you wish to do a server-side copy or move
between two remotes which use the same backend but are configured
differently.
Note that this isn't enabled by default because it isn't easy for
rclone to tell if it will work between any two configurations.
2015-06-06 09:05:21 +00:00
### --size-only ###
Normally rclone will look at modification time and size of files to
see if they are equal. If you set this flag then rclone will check
only the size.
2017-06-25 21:29:51 +00:00
This can be useful transferring files from Dropbox which have been
2015-06-06 09:05:21 +00:00
modified by the desktop sync client which doesn't set checksums of
modification times in the same way as rclone.
### --stats=TIME ###
2016-12-15 17:40:17 +00:00
Commands which transfer data (`sync`, `copy` , `copyto` , `move` ,
`moveto` ) will print data transfer stats at regular intervals to show
their progress.
2015-06-06 09:05:21 +00:00
This sets the interval.
2020-05-25 06:35:04 +00:00
The default is `1m` . Use `0` to disable.
2015-06-06 09:05:21 +00:00
2017-06-26 21:46:45 +00:00
If you set the stats interval then all commands can show stats. This
2016-12-15 17:40:17 +00:00
can be useful when running other commands, `check` or `mount` for
example.
2017-06-26 21:46:45 +00:00
Stats are logged at `INFO` level by default which means they won't
show at default log level `NOTICE` . Use `--stats-log-level NOTICE` or
`-v` to make them show. See the [Logging section ](#logging ) for more
info on log levels.
2018-06-02 16:38:05 +00:00
Note that on macOS you can send a SIGINFO (which is normally ctrl-T in
the terminal) to make the stats print immediately.
2018-01-10 23:44:25 +00:00
### --stats-file-name-length integer ###
2021-11-04 11:50:43 +00:00
By default, the `--stats` output will truncate file names and paths longer
than 40 characters. This is equivalent to providing
`--stats-file-name-length 40` . Use `--stats-file-name-length 0` to disable
2018-01-10 23:44:25 +00:00
any truncation of file names printed by stats.
2017-06-26 21:46:45 +00:00
### --stats-log-level string ###
Log level to show `--stats` output at. This can be `DEBUG` , `INFO` ,
`NOTICE` , or `ERROR` . The default is `INFO` . This means at the
default level of logging which is `NOTICE` the stats won't show - if
2018-01-10 23:44:25 +00:00
you want them to then use `--stats-log-level NOTICE` . See the [Logging
2017-06-26 21:46:45 +00:00
section](#logging) for more info on log levels.
2018-08-16 15:32:35 +00:00
### --stats-one-line ###
When this is specified, rclone condenses the stats into a single line
showing the most important stats only.
2019-03-26 02:41:45 +00:00
### --stats-one-line-date ###
When this is specified, rclone enables the single-line stats and prepends
the display with a date string. The default is `2006/01/02 15:04:05 - `
### --stats-one-line-date-format ###
When this is specified, rclone enables the single-line stats and prepends
the display with a user-supplied date string. The date string MUST be
enclosed in quotes. Follow [golang specs ](https://golang.org/pkg/time/#Time.Format ) for
date formatting syntax.
2016-11-22 04:04:05 +00:00
### --stats-unit=bits|bytes ###
2021-04-07 10:23:42 +00:00
By default, data transfer rates will be printed in bytes per second.
2016-11-22 04:04:05 +00:00
2021-04-07 10:23:42 +00:00
This option allows the data rate to be printed in bits per second.
2016-11-22 04:04:05 +00:00
Data transfer volume will still be reported in bytes.
The rate is reported as a binary unit, not SI unit. So 1 Mbit/s
2021-04-07 10:23:42 +00:00
equals 1,048,576 bit/s and not 1,000,000 bit/s.
2016-11-22 04:04:05 +00:00
The default is `bytes` .
2017-01-19 17:26:29 +00:00
### --suffix=SUFFIX ###
2019-06-23 03:52:09 +00:00
When using `sync` , `copy` or `move` any files which would have been
2021-11-04 11:50:43 +00:00
overwritten or deleted will have the suffix added to them. If there
is a file with the same path (after the suffix has been added), then
2019-06-23 03:52:09 +00:00
it will be overwritten.
2020-10-13 21:43:40 +00:00
The remote in use must support server-side move or copy and you must
2019-06-23 03:52:09 +00:00
use the same remote as the destination of the sync.
2021-11-04 11:50:43 +00:00
This is for use with files to add the suffix in the current directory
2019-06-23 03:52:09 +00:00
or with `--backup-dir` . See `--backup-dir` for more info.
2017-01-19 17:26:29 +00:00
2019-06-23 03:52:09 +00:00
For example
2023-01-20 20:47:36 +00:00
rclone copy --interactive /path/to/local/file remote:current --suffix .bak
2019-06-23 03:52:09 +00:00
2020-10-04 15:38:29 +00:00
will copy `/path/to/local` to `remote:current` , but for any files
2019-06-23 03:52:09 +00:00
which would have been updated or deleted have .bak added.
2017-01-19 17:26:29 +00:00
2020-10-04 15:38:29 +00:00
If using `rclone sync` with `--suffix` and without `--backup-dir` then
it is recommended to put a filter rule in excluding the suffix
otherwise the `sync` will delete the backup files.
2023-01-20 20:47:36 +00:00
rclone sync --interactive /path/to/local/file remote:current --suffix .bak --exclude "*.bak"
2020-10-04 15:38:29 +00:00
2019-03-10 16:50:28 +00:00
### --suffix-keep-extension ###
When using `--suffix` , setting this causes rclone put the SUFFIX
before the extension of the files that it backs up rather than after.
So let's say we had `--suffix -2019-01-01` , without the flag `file.txt`
would be backed up to `file.txt-2019-01-01` and with the flag it would
be backed up to `file-2019-01-01.txt` . This can be helpful to make
sure the suffixed files can still be opened.
2023-03-26 15:55:03 +00:00
If a file has two (or more) extensions and the second (or subsequent)
extension is recognised as a valid mime type, then the suffix will go
before that extension. So `file.tar.gz` would be backed up to
`file-2019-01-01.tar.gz` whereas `file.badextension.gz` would be
backed up to `file.badextension-2019-01-01.gz` .
2017-02-10 13:28:06 +00:00
### --syslog ###
On capable OSes (not Windows or Plan9) send all log output to syslog.
2017-06-25 21:29:51 +00:00
This can be useful for running rclone in a script or `rclone mount` .
2017-02-10 13:28:06 +00:00
2017-03-13 12:51:01 +00:00
### --syslog-facility string ###
2017-02-10 13:28:06 +00:00
2020-10-13 21:49:58 +00:00
If using `--syslog` this sets the syslog facility (e.g. `KERN` , `USER` ).
2017-02-10 13:28:06 +00:00
See `man syslog` for a list of possible facilities. The default
facility is `DAEMON` .
2021-09-10 12:44:13 +00:00
### --temp-dir=DIR ###
Specify the directory rclone will use for temporary files, to override
the default. Make sure the directory exists and have accessible permissions.
By default the operating system's temp directory will be used:
- On Unix systems, `$TMPDIR` if non-empty, else `/tmp` .
- On Windows, the first non-empty value from `%TMP%` , `%TEMP%` , `%USERPROFILE%` , or the Windows directory.
When overriding the default with this option, the specified path will be
set as value of environment variable `TMPDIR` on Unix systems
and `TMP` and `TEMP` on Windows.
You can use the [config paths ](/commands/rclone_config_paths/ )
command to see the current value.
2017-07-13 04:11:24 +00:00
### --tpslimit float ###
2021-01-06 12:19:23 +00:00
Limit transactions per second to this number. Default is 0 which is
used to mean unlimited transactions per second.
2017-07-13 04:11:24 +00:00
2021-01-06 12:19:23 +00:00
A transaction is roughly defined as an API call; its exact meaning
will depend on the backend. For HTTP based backends it is an HTTP
PUT/GET/POST/etc and its response. For FTP/SFTP it is a round trip
transaction over TCP.
2021-11-04 11:50:43 +00:00
For example, to limit rclone to 10 transactions per second use
2017-07-13 04:11:24 +00:00
`--tpslimit 10` , or to 1 transaction every 2 seconds use `--tpslimit
0.5`.
Use this when the number of transactions per second from rclone is
2020-10-13 21:49:58 +00:00
causing a problem with the cloud storage provider (e.g. getting you
2017-07-13 04:11:24 +00:00
banned or rate limited).
This can be very useful for `rclone mount` to control the behaviour of
applications using it.
2021-01-06 12:19:23 +00:00
This limit applies to all HTTP based backends and to the FTP and SFTP
2022-02-04 17:58:04 +00:00
backends. It does not apply to the local backend or the Storj backend.
2021-01-06 12:19:23 +00:00
2017-07-13 04:11:24 +00:00
See also `--tpslimit-burst` .
### --tpslimit-burst int ###
2020-05-25 06:35:39 +00:00
Max burst of transactions for `--tpslimit` (default `1` ).
2017-07-13 04:11:24 +00:00
Normally `--tpslimit` will do exactly the number of transaction per
second specified. However if you supply `--tps-burst` then rclone can
save up some transactions from when it was idle giving a burst of up
to the parameter supplied.
For example if you provide `--tpslimit-burst 10` then if rclone has
been idle for more than 10*`--tpslimit` then it can do 10 transactions
very quickly before they are limited again.
This may be used to increase performance of `--tpslimit` without
changing the long term average number of transactions per second.
2016-12-20 18:30:50 +00:00
### --track-renames ###
2017-06-25 21:29:51 +00:00
By default, rclone doesn't keep track of renamed files, so if you
2017-01-02 16:37:59 +00:00
rename a file locally then sync it to a remote, rclone will delete the
old file on the remote and upload a new copy.
2022-09-12 10:54:35 +00:00
An rclone sync with `--track-renames` runs like a normal sync, but keeps
track of objects which exist in the destination but not in the source
(which would normally be deleted), and which objects exist in the
source but not the destination (which would normally be transferred).
These objects are then candidates for renaming.
After the sync, rclone matches up the source only and destination only
objects using the `--track-renames-strategy` specified and either
renames the destination object or transfers the source and deletes the
destination object. `--track-renames` is stateless like all of
rclone's syncs.
To use this flag the destination must support server-side copy or
server-side move, and to use a hash based `--track-renames-strategy`
(the default) the source and the destination must have a compatible
hash.
2017-01-03 17:35:12 +00:00
2017-01-02 16:37:59 +00:00
If the destination does not support server-side copy or move, rclone
will fall back to the default behaviour and log an error level message
2020-08-03 21:30:48 +00:00
to the console.
Encrypted destinations are not currently supported by `--track-renames`
if `--track-renames-strategy` includes `hash` .
2016-12-20 18:30:50 +00:00
2018-11-25 16:49:38 +00:00
Note that `--track-renames` is incompatible with `--no-traverse` and
that it uses extra memory to keep track of all the rename candidates.
2017-01-03 17:35:12 +00:00
2017-01-25 19:35:14 +00:00
Note also that `--track-renames` is incompatible with
`--delete-before` and will select `--delete-after` instead of
`--delete-during` .
2020-06-09 19:40:03 +00:00
### --track-renames-strategy (hash,modtime,leaf,size) ###
2020-03-20 13:04:56 +00:00
2022-09-12 10:54:35 +00:00
This option changes the file matching criteria for `--track-renames` .
2020-06-09 19:40:03 +00:00
The matching is controlled by a comma separated selection of these tokens:
- `modtime` - the modification time of the file - not supported on all backends
- `hash` - the hash of the file contents - not supported on all backends
- `leaf` - the name of the file not including its directory name
- `size` - the size of the file (this is always enabled)
2022-09-12 10:54:35 +00:00
The default option is `hash` .
Using `--track-renames-strategy modtime,leaf` would match files
2020-06-09 19:40:03 +00:00
based on modification time, the leaf of the file name and the size
only.
Using `--track-renames-strategy modtime` or `leaf` can enable
`--track-renames` support for encrypted destinations.
2020-08-03 21:30:48 +00:00
Note that the `hash` strategy is not supported with encrypted destinations.
2016-01-12 13:33:03 +00:00
### --delete-(before,during,after) ###
This option allows you to specify when files on your destination are
deleted when you sync folders.
2016-06-25 13:28:26 +00:00
Specifying the value `--delete-before` will delete all files present
on the destination, but not on the source *before* starting the
2017-01-25 19:35:14 +00:00
transfer of any new or updated files. This uses two passes through the
file systems, one for the deletions and one for the copies.
Specifying `--delete-during` will delete files while checking and
uploading files. This is the fastest option and uses the least memory.
Specifying `--delete-after` (the default value) will delay deletion of
2017-06-01 01:12:34 +00:00
files until all new/updated files have been successfully transferred.
2017-01-25 19:35:14 +00:00
The files to be deleted are collected in the copy pass then deleted
2017-06-01 01:12:34 +00:00
after the copy pass has completed successfully. The files to be
2017-01-25 19:35:14 +00:00
deleted are held in memory so this mode may use more memory. This is
the safest mode as it will only delete files if there have been no
errors subsequent to that. If there have been errors before the
deletions start then you will get the message `not deleting files as
there were IO errors`.
2016-01-12 13:33:03 +00:00
2017-06-06 15:40:00 +00:00
### --fast-list ###
2020-10-13 21:49:58 +00:00
When doing anything which involves a directory listing (e.g. `sync` ,
2023-09-23 16:07:50 +00:00
`copy` , `ls` - in fact nearly every command), rclone has different
strategies to choose from.
The basic strategy is to list one directory and processes it before using
more directory lists to process any subdirectories. This is a mandatory
backend feature, called `List` , which means it is supported by all backends.
This strategy uses small amount of memory, and because it can be parallelised
it is fast for operations involving processing of the list results.
Some backends provide the support for an alternative strategy, where all
files beneath a directory can be listed in one (or a small number) of
transactions. Rclone supports this alternative strategy through an optional
backend feature called [`ListR` ](/overview/#listr ). You can see in the storage
system overview documentation's [optional features ](/overview/#optional-features )
section which backends it is enabled for (these tend to be the bucket-based
ones, e.g. S3, B2, GCS, Swift). This strategy requires fewer transactions
for highly recursive operations, which is important on backends where this
is charged or heavily rate limited. It may be faster (due to fewer transactions)
or slower (because it can't be parallelized) depending on different parameters,
and may require more memory if rclone has to keep the whole listing in memory.
Which listing strategy rclone picks for a given operation is complicated, but
in general it tries to choose the best possible. It will prefer `ListR` in
situations where it doesn't need to store the listed files in memory, e.g.
for unlimited recursive `ls` command variants. In other situations it will
prefer `List` , e.g. for `sync` and `copy` , where it needs to keep the listed
files in memory, and is performing operations on them where parallelization
may be a huge advantage.
Rclone is not able to take all relevant parameters into account for deciding
the best strategy, and therefore allows you to influence the choice in two ways:
You can stop rclone from using `ListR` by disabling the feature, using the
[--disable ](#disable-feature-feature ) option (`--disable ListR`), or you can
allow rclone to use `ListR` where it would normally choose not to do so due to
higher memory usage, using the `--fast-list` option. Rclone should always
produce identical results either way. Using `--disable ListR` or `--fast-list`
on a remote which doesn't support `ListR` does nothing, rclone will just ignore
it.
A rule of thumb is that if you pay for transactions and can fit your entire
sync listing into memory, then `--fast-list` is recommended. If you have a
very big sync to do, then don't use `--fast-list` , otherwise you will run out
of memory. Run some tests and compare before you decide, and if in doubt then
just leave the default, let rclone decide, i.e. not use `--fast-list` .
2017-06-06 15:40:00 +00:00
2015-06-06 09:05:21 +00:00
### --timeout=TIME ###
This sets the IO idle timeout. If a transfer has started but then
becomes idle for this long it is considered broken and disconnected.
2020-05-25 06:35:04 +00:00
The default is `5m` . Set to `0` to disable.
2015-06-06 09:05:21 +00:00
### --transfers=N ###
The number of file transfers to run in parallel. It can sometimes be
useful to set this to a smaller number if the remote is giving a lot
of timeouts or bigger if you have lots of bandwidth and a fast remote.
The default is to run 4 file transfers in parallel.
2022-04-27 17:40:39 +00:00
Look at --multi-thread-streams if you would like to control single file transfers.
2016-02-29 17:46:40 +00:00
### -u, --update ###
This forces rclone to skip any files which exist on the destination
and have a modified time that is newer than the source file.
2022-01-31 17:09:11 +00:00
This can be useful in avoiding needless transfers when transferring to
a remote which doesn't support modification times directly (or when
using `--use-server-modtime` to avoid extra API calls) as it is more
accurate than a `--size-only` check and faster than using
`--checksum` . On such remotes (or when using `--use-server-modtime` )
the time checked will be the uploaded time.
If an existing destination file has a modification time older than the
source file's, it will be updated if the sizes are different. If the
sizes are the same, it will be updated if the checksum is different or
not available.
2019-06-08 13:08:23 +00:00
2016-02-29 17:46:40 +00:00
If an existing destination file has a modification time equal (within
2022-01-31 17:09:11 +00:00
the computed modify window) to the source file's, it will be updated
if the sizes are different. The checksum will not be checked in this
case unless the `--checksum` flag is provided.
In all other cases the file will not be updated.
Consider using the `--modify-window` flag to compensate for time skews
between the source and the backend, for backends that do not support
mod times, and instead use uploaded times. However, if the backend
2022-08-14 02:56:32 +00:00
does not support checksums, note that syncing or copying within the
2022-01-31 17:09:11 +00:00
time skew window may still result in additional transfers for safety.
2016-02-29 17:46:40 +00:00
2018-05-22 13:48:23 +00:00
### --use-mmap ###
If this flag is set then rclone will use anonymous memory allocated by
mmap on Unix based platforms and VirtualAlloc on Windows for its
transfer buffers (size controlled by `--buffer-size` ). Memory
allocated like this does not go on the Go heap and can be returned to
the OS immediately when it is finished with.
If this flag is not set then rclone will allocate and free the buffers
using the Go memory allocator which may use more memory as memory
pages are returned less aggressively to the OS.
It is possible this does not work well on all platforms so it is
disabled by default; in the future it may be enabled by default.
2018-04-13 12:32:17 +00:00
### --use-server-modtime ###
Some object-store backends (e.g, Swift, S3) do not preserve file modification
times (modtime). On these backends, rclone stores the original modtime as
additional metadata on the object. By default it will make an API call to
retrieve the metadata when the modtime is needed by an operation.
Use this flag to disable the extra API call and rely instead on the server's
2019-07-02 09:09:03 +00:00
modified time. In cases such as a local to remote sync using `--update` ,
knowing the local file is newer than the time it was last uploaded to the
remote is sufficient. In those cases, this flag can speed up the process and
reduce the number of API calls necessary.
Using this flag on a sync operation without also using `--update` would cause
all files modified at any time other than the last upload time to be uploaded
again, which is probably not what you want.
2018-04-13 12:32:17 +00:00
2017-02-09 21:22:46 +00:00
### -v, -vv, --verbose ###
2015-06-06 09:05:21 +00:00
2017-02-09 21:22:46 +00:00
With `-v` rclone will tell you about each file that is transferred and
a small number of significant events.
2015-06-06 09:05:21 +00:00
2017-02-09 21:22:46 +00:00
With `-vv` rclone will become very verbose telling you about every
file it considers and transfers. Please send bug reports with a log
with this setting.
2015-06-06 09:05:21 +00:00
2022-06-01 18:00:43 +00:00
When setting verbosity as an environment variable, use
`RCLONE_VERBOSE=1` or `RCLONE_VERBOSE=2` for `-v` and `-vv` respectively.
2015-06-06 09:05:21 +00:00
### -V, --version ###
Prints the version number
2019-02-11 13:09:32 +00:00
SSL/TLS options
---------------
2020-05-19 11:02:44 +00:00
The outgoing SSL/TLS connections rclone makes can be controlled with
2019-02-11 13:09:32 +00:00
these options. For example this can be very useful with the HTTP or
WebDAV backends. Rclone HTTP servers have their own set of
configuration for SSL/TLS which you can find in their documentation.
2023-01-11 07:59:51 +00:00
### --ca-cert stringArray
2019-02-11 13:09:32 +00:00
2023-01-11 07:59:51 +00:00
This loads the PEM encoded certificate authority certificates and uses
2019-02-11 13:09:32 +00:00
it to verify the certificates of the servers rclone connects to.
If you have generated certificates signed with a local CA then you
will need this flag to connect to servers using those certificates.
### --client-cert string
This loads the PEM encoded client side certificate.
This is used for [mutual TLS authentication ](https://en.wikipedia.org/wiki/Mutual_authentication ).
The `--client-key` flag is required too when using this.
### --client-key string
This loads the PEM encoded client side private key used for mutual TLS
authentication. Used in conjunction with `--client-cert` .
### --no-check-certificate=true/false ###
`--no-check-certificate` controls whether a client verifies the
server's certificate chain and host name.
If `--no-check-certificate` is true, TLS accepts any certificate
presented by the server and any host name in that certificate.
In this mode, TLS is susceptible to man-in-the-middle attacks.
This option defaults to `false` .
**This should be used only for testing.**
2016-02-16 15:25:27 +00:00
Configuration Encryption
------------------------
2021-11-04 11:50:43 +00:00
Your configuration file contains information for logging in to
your cloud services. This means that you should keep your
2021-03-16 11:36:57 +00:00
`rclone.conf` file in a secure location.
2016-02-16 15:25:27 +00:00
If you are in an environment where that isn't possible, you can
add a password to your configuration. This means that you will
2019-11-18 09:55:27 +00:00
have to supply the password every time you start rclone.
2016-02-16 15:25:27 +00:00
To add a password to your rclone configuration, execute `rclone config` .
```
>rclone config
Current remotes:
e) Edit existing remote
n) New remote
d) Delete remote
s) Set configuration password
q) Quit config
e/n/d/s/q>
```
Go into `s` , Set configuration password:
```
e/n/d/s/q> s
Your configuration is not encrypted.
If you add a password, you will protect your login information to cloud services.
a) Add Password
q) Quit to main menu
a/q> a
Enter NEW configuration password:
2016-03-29 20:10:35 +00:00
password:
2016-02-16 15:25:27 +00:00
Confirm NEW password:
2016-03-29 20:10:35 +00:00
password:
2016-02-16 15:25:27 +00:00
Password set
Your configuration is encrypted.
c) Change Password
u) Unencrypt configuration
q) Quit to main menu
c/u/q>
```
Your configuration is now encrypted, and every time you start rclone
2019-11-18 09:55:27 +00:00
you will have to supply the password. See below for details.
In the same menu, you can change the password or completely remove
encryption from your configuration.
2016-02-16 15:25:27 +00:00
There is no way to recover the configuration if you lose your password.
2024-09-05 10:52:15 +00:00
You can also use
- [rclone config encryption set ](/commands/rclone_config_encryption_set/ ) to set the config encryption directly
- [rclone config encryption remove ](/commands/rclone_config_encryption_remove/ ) to remove it
- [rclone config encryption check ](/commands/rclone_config_encryption_check/ ) to check that it is encrypted properly.
2021-11-04 11:50:43 +00:00
rclone uses [nacl secretbox ](https://godoc.org/golang.org/x/crypto/nacl/secretbox )
which in turn uses XSalsa20 and Poly1305 to encrypt and authenticate
2016-02-16 15:25:27 +00:00
your configuration with secret-key cryptography.
The password is SHA-256 hashed, which produces the key for secretbox.
The hashed password is not stored.
While this provides very good security, we do not recommend storing
2016-04-20 02:50:28 +00:00
your encrypted rclone configuration in public if it contains sensitive
2016-02-16 15:25:27 +00:00
information, maybe except if you use a very strong password.
If it is safe in your environment, you can set the `RCLONE_CONFIG_PASS`
environment variable to contain your password, in which case it will be
used for decrypting the configuration.
2016-12-12 12:33:43 +00:00
You can set this for a session from a script. For unix like systems
save this to a file called `set-rclone-password` :
```
#!/bin/echo Source this file don't run it
read -s RCLONE_CONFIG_PASS
export RCLONE_CONFIG_PASS
```
Then source the file when you want to use it. From the shell you
would do `source set-rclone-password` . It will then ask you for the
2017-06-01 01:12:34 +00:00
password and set it in the environment variable.
2016-12-12 12:33:43 +00:00
2019-11-18 09:55:27 +00:00
An alternate means of supplying the password is to provide a script
which will retrieve the password and print on standard output. This
script should have a fully specified path name and not rely on any
environment variables. The script is supplied either via
2024-09-05 10:52:15 +00:00
[`--password-command="..."` ](#password-command ) command line argument or via the
2020-01-23 13:54:18 +00:00
`RCLONE_PASSWORD_COMMAND` environment variable.
2019-11-18 09:55:27 +00:00
One useful example of this is using the `passwordstore` application
to retrieve the password:
```
2020-01-23 13:54:18 +00:00
export RCLONE_PASSWORD_COMMAND="pass rclone/config"
2019-11-18 09:55:27 +00:00
```
If the `passwordstore` password manager holds the password for the
rclone configuration, using the script method means the password
is primarily protected by the `passwordstore` system, and is never
embedded in the clear in scripts, nor available for examination
using the standard commands available. It is quite possible with
long running rclone sessions for copies of passwords to be innocently
captured in log files or terminal scroll buffers, etc. Using the
script method of supplying the password enhances the security of
the config password considerably.
If you are running rclone inside a script, unless you are using the
2021-11-04 11:50:43 +00:00
`--password-command` method, you might want to disable
password prompts. To do that, pass the parameter
2016-02-17 10:45:05 +00:00
`--ask-password=false` to rclone. This will make rclone fail instead
2016-04-20 02:50:28 +00:00
of asking for a password if `RCLONE_CONFIG_PASS` doesn't contain
2020-01-23 13:54:18 +00:00
a valid password, and `--password-command` has not been supplied.
2016-02-17 10:45:05 +00:00
2021-04-26 21:37:49 +00:00
Whenever running commands that may be affected by options in a
configuration file, rclone will look for an existing file according
to the rules described [above ](#config-config-file ), and load any it
finds. If an encrypted file is found, this includes decrypting it,
with the possible consequence of a password prompt. When executing
a command line that you know are not actually using anything from such
a configuration file, you can avoid it being loaded by overriding the
location, e.g. with one of the documented special values for
memory-only configuration. Since only backend options can be stored
in configuration files, this is normally unnecessary for commands
2024-01-31 16:43:20 +00:00
that do not operate on backends, e.g. `completion` . However,
2021-04-26 21:37:49 +00:00
it will be relevant for commands that do operate on backends in
general, but are used without referencing a stored remote, e.g.
listing local filesystem paths, or
[connection strings ](#connection-strings ): `rclone --config="" ls .`
2016-02-16 15:25:27 +00:00
2024-09-05 00:01:12 +00:00
Configuration Encryption Cheatsheet
-----------------------------------
You can quickly apply a configuration encryption without plain-text
at rest or transfer. Detailed instructions for popular OSes:
### Mac ###
* Generate and store a password
`security add-generic-password -a rclone -s config -w $(openssl rand -base64 40)`
* Add the retrieval instruction to your .zprofile / .profile
`export RCLONE_PASSWORD_COMMAND="/usr/bin/security find-generic-password -a rclone -s config -w"`
### Linux ###
* Prerequisite
Linux doesn't come with a default password manager. Let's install
the "pass" utility using a package manager, e.g. `apt install pass` ,
`yum install pass` ,
[etc. ](https://www.passwordstore.org/#download ); then initialize a
password store:
`pass init rclone`
* Generate and store a password
`echo $(openssl rand -base64 40) | pass insert -m rclone/config`
* Add the retrieval instruction
`export RCLONE_PASSWORD_COMMAND="/usr/bin/pass rclone/config"`
### Windows ###
* Generate and store a password
`New-Object -TypeName PSCredential -ArgumentList "rclone", (ConvertTo-SecureString -String ([System.Web.Security.Membership]::GeneratePassword(40, 10)) -AsPlainText -Force) | Export-Clixml -Path "rclone-credential.xml"`
* Add the password retrieval instruction
`[Environment]::SetEnvironmentVariable("RCLONE_PASSWORD_COMMAND", "[System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR((Import-Clixml -Path "rclone-credential.xml").Password))")`
### Encrypt the config file (all systems) ###
* Execute `rclone config` -> `s`
* Add/update the password from previous steps
2015-06-06 09:05:21 +00:00
Developer options
-----------------
2014-03-28 22:34:13 +00:00
2015-06-06 09:05:21 +00:00
These options are useful when developing or debugging rclone. There
are also some more remote specific options which aren't documented
2020-10-13 21:49:58 +00:00
here which are used for testing. These start with remote name e.g.
2016-01-10 12:04:20 +00:00
`--drive-test-option` - see the docs for the remote in question.
2014-03-28 22:34:13 +00:00
2015-06-06 09:05:21 +00:00
### --cpuprofile=FILE ###
2014-03-28 22:34:13 +00:00
2016-01-10 12:04:20 +00:00
Write CPU profile to file. This can be analysed with `go tool pprof` .
2017-11-20 20:21:44 +00:00
#### --dump flag,flag,flag ####
2016-11-02 15:53:43 +00:00
2017-11-20 20:21:44 +00:00
The `--dump` flag takes a comma separated list of flags to dump info
2020-01-21 16:34:29 +00:00
about.
2021-11-04 11:50:43 +00:00
Note that some headers including `Accept-Encoding` as shown may not
2020-01-21 16:34:29 +00:00
be correct in the request and the response may not show `Content-Encoding`
2021-11-04 11:50:43 +00:00
if the go standard libraries auto gzip encoding was in effect. In this case
2020-01-21 16:34:29 +00:00
the body of the request will be gunzipped before showing it.
The available flags are:
2017-11-20 20:21:44 +00:00
#### --dump headers ####
Dump HTTP headers with `Authorization:` lines removed. May still
contain sensitive info. Can be very verbose. Useful for debugging
2016-11-02 15:53:43 +00:00
only.
2017-11-20 20:21:44 +00:00
Use `--dump auth` if you do want the `Authorization:` headers.
#### --dump bodies ####
2016-01-10 12:04:20 +00:00
Dump HTTP headers and bodies - may contain sensitive info. Can be
very verbose. Useful for debugging only.
2017-07-30 09:02:14 +00:00
Note that the bodies are buffered in memory so don't use this for
enormous files.
2017-11-20 20:21:44 +00:00
#### --dump requests ####
2016-01-10 12:04:20 +00:00
2017-11-20 20:21:44 +00:00
Like `--dump bodies` but dumps the request bodies and the response
headers. Useful for debugging download problems.
2016-01-10 12:04:20 +00:00
2017-11-20 20:21:44 +00:00
#### --dump responses ####
2016-01-10 12:04:20 +00:00
2017-11-20 20:21:44 +00:00
Like `--dump bodies` but dumps the response bodies and the request
headers. Useful for debugging upload problems.
#### --dump auth ####
Dump HTTP headers - will contain sensitive info such as
`Authorization:` headers - use `--dump headers` to dump without
`Authorization:` headers. Can be very verbose. Useful for debugging
2016-11-02 15:53:43 +00:00
only.
2017-11-20 20:21:44 +00:00
#### --dump filters ####
Dump the filters to the output. Useful to see exactly what include
and exclude options are filtering on.
2016-01-10 12:04:20 +00:00
2018-04-11 13:16:55 +00:00
#### --dump goroutines ####
This dumps a list of the running go-routines at the end of the command
to standard output.
#### --dump openfiles ####
This dumps a list of the open files at the end of the command. It
uses the `lsof` command to do that so you'll need that installed to
use it.
2023-10-23 22:47:18 +00:00
#### --dump mapper ####
This shows the JSON blobs being sent to the program supplied with
`--metadata-mapper` and received from it. It can be useful for
debugging the metadata mapper interface.
2016-01-10 12:04:20 +00:00
### --memprofile=FILE ###
Write memory profile to file. This can be analysed with `go tool pprof` .
2015-09-27 15:13:20 +00:00
Filtering
---------
For the filtering options
* `--delete-excluded`
* `--filter`
* `--filter-from`
* `--exclude`
* `--exclude-from`
2022-06-08 07:29:01 +00:00
* `--exclude-if-present`
2015-09-27 15:13:20 +00:00
* `--include`
* `--include-from`
* `--files-from`
2020-04-03 09:36:24 +00:00
* `--files-from-raw`
2015-09-27 15:13:20 +00:00
* `--min-size`
* `--max-size`
2015-12-29 19:34:10 +00:00
* `--min-age`
* `--max-age`
2017-11-20 20:21:44 +00:00
* `--dump filters`
2022-08-04 17:19:05 +00:00
* `--metadata-include`
* `--metadata-include-from`
* `--metadata-exclude`
* `--metadata-exclude-from`
* `--metadata-filter`
* `--metadata-filter-from`
2015-09-27 15:13:20 +00:00
See the [filtering section ](/filtering/ ).
2016-01-31 16:15:25 +00:00
2018-03-05 11:44:16 +00:00
Remote control
--------------
For the remote control options and for instructions on how to remote control rclone
* `--rc`
* and anything starting with `--rc-`
See [the remote control section ](/rc/ ).
2016-06-04 17:49:27 +00:00
Logging
-------
2018-03-08 05:20:26 +00:00
rclone has 4 levels of logging, `ERROR` , `NOTICE` , `INFO` and `DEBUG` .
2016-06-04 17:49:27 +00:00
2017-06-25 21:29:51 +00:00
By default, rclone logs to standard error. This means you can redirect
2020-10-13 21:49:58 +00:00
standard error and still see the normal output of rclone commands (e.g.
2017-02-09 21:22:46 +00:00
`rclone ls` ).
2016-06-04 17:49:27 +00:00
2017-06-25 21:29:51 +00:00
By default, rclone will produce `Error` and `Notice` level messages.
2016-06-04 17:49:27 +00:00
If you use the `-q` flag, rclone will only produce `Error` messages.
2017-02-09 21:22:46 +00:00
If you use the `-v` flag, rclone will produce `Error` , `Notice` and
`Info` messages.
If you use the `-vv` flag, rclone will produce `Error` , `Notice` ,
`Info` and `Debug` messages.
You can also control the log levels with the `--log-level` flag.
2016-06-04 17:49:27 +00:00
If you use the `--log-file=FILE` option, rclone will redirect `Error` ,
`Info` and `Debug` messages along with standard error to FILE.
2017-02-09 21:22:46 +00:00
If you use the `--syslog` flag then rclone will log to syslog and the
`--syslog-facility` control which facility it uses.
2020-10-13 21:49:58 +00:00
Rclone prefixes all log messages with their level in capitals, e.g. INFO
2017-02-09 21:22:46 +00:00
which makes it easy to grep the log file for different kinds of
information.
2024-09-06 14:00:36 +00:00
Metrics
-------
Rclone can publish metrics in the OpenMetrics/Prometheus format.
To enable the metrics endpoint, use the `--metrics-addr` flag. Metrics can also be published on the `--rc-addr` port if the `--rc` flag and `--rc-enable-metrics` flags are supplied or if using rclone rcd `--rc-enable-metrics`
Rclone provides extensive configuration options for the metrics HTTP endpoint. These settings are grouped under the Metrics section and have a prefix `--metrics-*` .
When metrics are enabled with `--rc-enable-metrics` , they will be published on the same port as the rc API. In this case, the `--metrics-*` flags will be ignored, and the HTTP endpoint configuration will be managed by the `--rc-*` parameters.
2016-01-31 16:15:25 +00:00
Exit Code
---------
2017-06-25 21:29:51 +00:00
If any errors occur during the command execution, rclone will exit with a
2017-02-22 18:00:56 +00:00
non-zero exit code. This allows scripts to detect when rclone
operations have failed.
2016-09-12 14:42:57 +00:00
2017-06-25 21:29:51 +00:00
During the startup phase, rclone will exit immediately if an error is
2016-09-12 14:42:57 +00:00
detected in the configuration. There will always be a log message
immediately before exiting.
When rclone is running it will accumulate errors as it goes along, and
2017-06-25 21:29:51 +00:00
only exit with a non-zero exit code if (after retries) there were
2017-02-22 18:00:56 +00:00
still failed transfers. For every error counted there will be a high
2017-06-01 01:12:34 +00:00
priority log message (visible with `-q` ) showing the message and
2017-02-22 18:00:56 +00:00
which file caused the problem. A high priority message is also shown
when starting a retry so the user can see that any previous error
messages may not be valid after the retry. If rclone has done a retry
it will log a high priority message if the retry was successful.
2017-01-03 22:42:08 +00:00
2017-11-15 05:32:00 +00:00
### List of exit codes ###
* `0` - success
* `1` - Syntax or usage error
* `2` - Error not otherwise categorised
* `3` - Directory not found
* `4` - File not found
* `5` - Temporary error (one that more retries might fix) (Retry errors)
* `6` - Less serious errors (like 461 errors from dropbox) (NoRetry errors)
* `7` - Fatal error (one that more retries won't fix, like account suspended) (Fatal errors)
2018-05-03 14:04:30 +00:00
* `8` - Transfer exceeded - limit set by --max-transfer reached
2024-05-07 07:18:05 +00:00
* `9` - Operation successful, but no files transferred (Requires [`--error-on-no-transfer` ](#error-on-no-transfer ))
2023-07-15 16:41:13 +00:00
* `10` - Duration exceeded - limit set by --max-duration reached
2017-11-15 05:32:00 +00:00
2017-01-03 22:42:08 +00:00
Environment Variables
---------------------
Rclone can be configured entirely using environment variables. These
can be used to set defaults for options or config file entries.
### Options ###
Every option in rclone can have its default set by environment
variable.
2017-06-25 21:29:51 +00:00
To find the name of the environment variable, first, take the long
2017-01-03 22:42:08 +00:00
option name, strip the leading `--` , change `-` to `_` , make
upper case and prepend `RCLONE_` .
2017-06-25 21:29:51 +00:00
For example, to always set `--stats 5s` , set the environment variable
2017-01-03 22:42:08 +00:00
`RCLONE_STATS=5s` . If you set stats on the command line this will
override the environment variable setting.
Or to always use the trash in drive `--drive-use-trash` , set
`RCLONE_DRIVE_USE_TRASH=true` .
2022-06-01 18:00:43 +00:00
Verbosity is slightly different, the environment variable
equivalent of `--verbose` or `-v` is `RCLONE_VERBOSE=1` ,
or for `-vv` , `RCLONE_VERBOSE=2` .
2017-01-03 22:42:08 +00:00
The same parser is used for the options and the environment variables
so they take exactly the same form.
2021-05-20 12:08:01 +00:00
The options set by environment variables can be seen with the `-vv` flag, e.g. `rclone version -vv` .
2017-01-03 22:42:08 +00:00
### Config file ###
You can set defaults for values in the config file on an individual
2021-02-09 09:30:40 +00:00
remote basis. The names of the config items are documented in the page
for each backend.
2017-01-03 22:42:08 +00:00
To find the name of the environment variable, you need to set, take
2017-10-14 20:42:38 +00:00
`RCLONE_CONFIG_` + name of remote + `_` + name of config file option
and make it all uppercase.
2023-08-09 10:42:04 +00:00
Note one implication here is the remote's name must be
convertible into a valid environment variable name,
so it can only contain letters, digits, or the `_` (underscore) character.
2017-01-03 22:42:08 +00:00
2017-06-25 21:29:51 +00:00
For example, to configure an S3 remote named `mys3:` without a config
2017-01-03 22:42:08 +00:00
file (using unix ways of setting environment variables):
```
$ export RCLONE_CONFIG_MYS3_TYPE=s3
$ export RCLONE_CONFIG_MYS3_ACCESS_KEY_ID=XXX
$ export RCLONE_CONFIG_MYS3_SECRET_ACCESS_KEY=XXX
2021-09-16 18:02:16 +00:00
$ rclone lsd mys3:
2017-01-03 22:42:08 +00:00
-1 2016-09-21 12:54:21 -1 my-bucket
$ rclone listremotes | grep mys3
mys3:
```
Note that if you want to create a remote using environment variables
you must create the `..._TYPE` variable as above.
2021-09-16 18:02:16 +00:00
Note that the name of a remote created using environment variable is
case insensitive, in contrast to regular remotes stored in config
file as documented [above ](#valid-remote-names ).
You must write the name in uppercase in the environment variable, but
as seen from example above it will be listed and can be accessed in
lowercase, while you can also refer to the same remote in uppercase:
```
$ rclone lsd mys3:
-1 2016-09-21 12:54:21 -1 my-bucket
$ rclone lsd MYS3:
-1 2016-09-21 12:54:21 -1 my-bucket
```
cmdtest: end-to-end test for commands, flags and environment variables
There was no easy way to automatically test the end-to-end functionality
of commands, flags, environment variables etc.
The need for end-to-end testing was highlighted by the issues fixed
in #5341. There was no automated test to continually verify current
behaviour, nor a framework to quickly test the correctness of the fixes.
This change adds an end-to-end testing framework in the cmdtest folder.
It has some simple examples in func TestCmdTest in cmdtest_test.go. The
tests should be readable by anybody familiar with rclone and look like
this:
// Test the rclone version command with debug logging (-vv)
out, err = rclone("version", "-vv")
if assert.NoError(t, err) {
assert.Contains(t, out, "rclone v")
assert.Contains(t, out, "os/version:")
assert.Contains(t, out, " DEBUG : ")
}
The end-to-end tests are executed just like the Go unit tests, that is:
go test ./cmdtest -v
The change also contains a thorough test of environment variables in
environment_test.go.
Thanks to @ncw for encouragement and introduction to the TestMain trick.
2021-06-04 08:56:40 +00:00
Note that you can only set the options of the immediate backend,
so RCLONE_CONFIG_MYS3CRYPT_ACCESS_KEY_ID has no effect, if myS3Crypt is
a crypt remote based on an S3 remote. However RCLONE_S3_ACCESS_KEY_ID will
set the access key of all remotes using S3, including myS3Crypt.
2021-04-08 08:19:03 +00:00
Note also that now rclone has [connection strings ](#connection-strings ),
2021-02-09 09:30:40 +00:00
it is probably easier to use those instead which makes the above example
rclone lsd :s3,access_key_id=XXX,secret_access_key=XXX:
2020-07-07 10:12:35 +00:00
### Precedence
The various different methods of backend configuration are read in
this order and the first one with a value is used.
2021-05-20 12:08:01 +00:00
- Parameters in connection strings, e.g. `myRemote,skip_links:`
- Flag values as supplied on the command line, e.g. `--skip-links`
- Remote specific environment vars, e.g. `RCLONE_CONFIG_MYREMOTE_SKIP_LINKS` (see above).
2021-11-04 11:50:43 +00:00
- Backend-specific environment vars, e.g. `RCLONE_LOCAL_SKIP_LINKS` .
2021-05-20 12:08:01 +00:00
- Backend generic environment vars, e.g. `RCLONE_SKIP_LINKS` .
- Config file, e.g. `skip_links = true` .
- Default values, e.g. `false` - these can't be changed.
2020-07-07 10:12:35 +00:00
2021-05-20 12:08:01 +00:00
So if both `--skip-links` is supplied on the command line and an
environment variable `RCLONE_LOCAL_SKIP_LINKS` is set, the command line
2020-07-07 10:12:35 +00:00
flag will take preference.
2021-05-20 12:08:01 +00:00
The backend configurations set by environment variables can be seen with the `-vv` flag, e.g. `rclone about myRemote: -vv` .
2020-07-07 10:12:35 +00:00
For non backend configuration the order is as follows:
2020-10-13 21:49:58 +00:00
- Flag values as supplied on the command line, e.g. `--stats 5s` .
- Environment vars, e.g. `RCLONE_STATS=5s` .
- Default values, e.g. `1m` - these can't be changed.
2020-07-07 10:12:35 +00:00
2017-01-03 22:42:08 +00:00
### Other environment variables ###
2020-06-02 10:46:28 +00:00
- `RCLONE_CONFIG_PASS` set to contain your config file password (see [Configuration Encryption ](#configuration-encryption ) section)
- `HTTP_PROXY` , `HTTPS_PROXY` and `NO_PROXY` (or the lowercase versions thereof).
- `HTTPS_PROXY` takes precedence over `HTTP_PROXY` for https requests.
- The environment values may be either a complete URL or a "host[:port]" for, in which case the "http" scheme is assumed.
2021-06-13 16:45:17 +00:00
- `USER` and `LOGNAME` values are used as fallbacks for current username. The primary method for looking up username is OS-specific: Windows API on Windows, real user ID in /etc/passwd on Unix systems. In the documentation the current username is simply referred to as `$USER` .
2020-06-02 10:46:28 +00:00
- `RCLONE_CONFIG_DIR` - rclone **sets** this variable for use in config files and sub processes to point to the directory holding the config file.
2021-05-20 12:08:01 +00:00
The options set by environment variables can be seen with the `-vv` and `--log-level=DEBUG` flags, e.g. `rclone version -vv` .