2014-03-28 23:34:13 +01:00
---
title: "Google drive"
description: "Rclone docs for Google drive"
---
2021-07-20 20:45:41 +02:00
# {{< icon "fab fa-google" >}} Google Drive
2014-07-17 21:03:11 +02:00
2014-03-28 23:34:13 +01:00
Paths are specified as `drive:path`
2020-10-13 23:49:58 +02:00
Drive paths may be as deep as required, e.g. `drive:directory/subdirectory` .
2014-03-28 23:34:13 +01:00
2021-10-14 15:40:18 +02:00
## Configuration
2014-03-28 23:34:13 +01:00
The initial setup for drive involves getting a token from Google drive
which you need to do in your browser. `rclone config` walks you
through it.
Here is an example of how to make a remote called `remote` . First run:
rclone config
This will guide you through an interactive setup process:
```
2021-11-01 21:34:46 +01:00
No remotes found, make a new one?
2014-03-28 23:34:13 +01:00
n) New remote
2017-06-01 21:12:11 +02:00
r) Rename remote
c) Copy remote
s) Set configuration password
2014-03-28 23:34:13 +01:00
q) Quit config
2017-06-01 21:12:11 +02:00
n/r/c/s/q> n
2014-03-28 23:34:13 +01:00
name> remote
2016-02-21 14:39:04 +01:00
Type of storage to configure.
Choose a number from below, or type in your own value
2018-01-23 14:36:20 +01:00
[snip]
2019-08-26 11:47:17 +02:00
XX / Google Drive
2016-02-21 14:39:04 +01:00
\ "drive"
2018-01-23 14:36:20 +01:00
[snip]
Storage> drive
2015-10-03 15:23:12 +02:00
Google Application Client Id - leave blank normally.
2017-09-01 19:54:14 +02:00
client_id>
2015-10-03 15:23:12 +02:00
Google Application Client Secret - leave blank normally.
2017-09-01 19:54:14 +02:00
client_secret>
2018-01-23 14:36:20 +01:00
Scope that rclone should use when requesting access from drive.
Choose a number from below, or type in your own value
1 / Full access all files, excluding Application Data Folder.
\ "drive"
2 / Read-only access to file metadata and file contents.
\ "drive.readonly"
/ Access to files created by rclone only.
3 | These are visible in the drive website.
| File authorization is revoked when the user deauthorizes the app.
\ "drive.file"
/ Allows read and write access to the Application Data folder.
4 | This is not visible in the drive website.
\ "drive.appfolder"
/ Allows read-only access to file metadata but
5 | does not allow any access to read or download file content.
\ "drive.metadata.readonly"
scope> 1
2017-11-29 22:34:19 +01:00
Service Account Credentials JSON file path - needed only if you want use SA instead of interactive login.
service_account_file>
2014-03-28 23:34:13 +01:00
Remote config
2015-09-12 15:17:39 +02:00
Use auto config?
* Say Y if not sure
2015-09-30 16:04:02 +02:00
* Say N if you are working on a remote or headless machine or Y didn't work
2015-09-12 15:17:39 +02:00
y) Yes
n) No
y/n> y
If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth
Log in and authorize rclone for access
Waiting for code...
Got code
2021-02-07 12:38:17 +01:00
Configure this as a Shared Drive (Team Drive)?
2017-06-01 21:12:11 +02:00
y) Yes
n) No
y/n> n
2014-03-28 23:34:13 +01:00
--------------------
[remote]
2018-01-23 14:36:20 +01:00
client_id =
client_secret =
scope = drive
root_folder_id =
service_account_file =
token = {"access_token":"XXX","token_type":"Bearer","refresh_token":"XXX","expiry":"2014-03-16T13:57:58.955387075Z"}
2014-03-28 23:34:13 +01:00
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y
```
2015-09-12 15:17:39 +02:00
Note that rclone runs a webserver on your local machine to collect the
token as returned from Google if you use auto config mode. This only
runs from the moment it opens your browser to the moment you get back
2022-02-22 22:05:05 +01:00
the verification code. This is on `http://127.0.0.1:53682/` and it
may require you to unblock it temporarily if you are running a host
2015-09-12 15:17:39 +02:00
firewall, or use manual mode.
2014-03-28 23:34:13 +01:00
You can then use it like this,
List directories in top level of your drive
rclone lsd remote:
List all the files in your drive
rclone ls remote:
To copy a local directory to a drive directory called backup
rclone copy /home/source remote:backup
2021-10-14 15:40:18 +02:00
### Scopes
2018-01-23 14:36:20 +01:00
Rclone allows you to select which scope you would like for rclone to
use. This changes what type of token is granted to rclone. [The
scopes are defined
2020-05-26 01:26:20 +02:00
here](https://developers.google.com/drive/v3/web/about-auth).
2018-01-23 14:36:20 +01:00
The scope are
2021-10-14 15:40:18 +02:00
#### drive
2018-01-23 14:36:20 +01:00
This is the default scope and allows full access to all files, except
for the Application Data Folder (see below).
Choose this one if you aren't sure.
2021-10-14 15:40:18 +02:00
#### drive.readonly
2018-01-23 14:36:20 +01:00
This allows read only access to all files. Files may be listed and
downloaded but not uploaded, renamed or deleted.
2021-10-14 15:40:18 +02:00
#### drive.file
2018-01-23 14:36:20 +01:00
With this scope rclone can read/view/modify only those files and
folders it creates.
So if you uploaded files to drive via the web interface (or any other
means) they will not be visible to rclone.
This can be useful if you are using rclone to backup data and you want
to be sure confidential data on your drive is not visible to rclone.
Files created with this scope are visible in the web interface.
2021-10-14 15:40:18 +02:00
#### drive.appfolder
2018-01-23 14:36:20 +01:00
This gives rclone its own private area to store files. Rclone will
not be able to see any other files on your drive and you won't be able
to see rclone's files from the web interface either.
2021-10-14 15:40:18 +02:00
#### drive.metadata.readonly
2018-01-23 14:36:20 +01:00
This allows read only access to file names only. It does not allow
rclone to download or upload data, or rename or delete files or
directories.
2021-10-14 15:40:18 +02:00
### Root folder ID
2018-01-23 14:36:20 +01:00
2022-06-23 22:08:09 +02:00
This option has been moved to the advanced section. You can set the `root_folder_id` for rclone. This is the directory
2019-03-27 20:12:24 +01:00
(identified by its `Folder ID` ) that rclone considers to be the root
2018-01-30 11:31:49 +01:00
of your drive.
Normally you will leave this blank and rclone will determine the
correct root to use itself.
However you can set this to restrict rclone to a specific folder
hierarchy or to access data within the "Computers" tab on the drive
web interface (where files from Google's Backup and Sync desktop
program go).
In order to do this you will have to find the `Folder ID` of the
directory you wish rclone to display. This will be the last segment
of the URL when you open the relevant folder in the drive web
interface.
So if the folder you want rclone to use has a URL which looks like
2018-01-23 14:36:20 +01:00
`https://drive.google.com/drive/folders/1XyfxxxxxxxxxxxxxxxxxxxxxxxxxKHCh`
in the browser, then you use `1XyfxxxxxxxxxxxxxxxxxxxxxxxxxKHCh` as
the `root_folder_id` in the config.
2018-01-30 11:31:49 +01:00
**NB** folders under the "Computers" tab seem to be read only (drive
gives a 500 error) when using rclone.
2018-01-23 14:36:20 +01:00
There doesn't appear to be an API to discover the folder IDs of the
"Computers" tab - please contact us if you know otherwise!
2018-01-30 11:31:49 +01:00
Note also that rclone can't access any data under the "Backups" tab on
the google drive web interface yet.
2021-10-14 15:40:18 +02:00
### Service Account support
2017-11-29 22:34:19 +01:00
You can set up rclone with Google Drive in an unattended mode,
i.e. not tied to a specific end-user Google account. This is useful
when you want to synchronise files onto machines that don't have
actively logged-in users, for example build machines.
To use a Service Account instead of OAuth2 token flow, enter the path
to your Service Account credentials at the `service_account_file`
2018-03-17 00:51:19 +01:00
prompt during `rclone config` and rclone won't use the browser based
2018-04-27 17:07:37 +02:00
authentication flow. If you'd rather stuff the contents of the
credentials file into the rclone config file, you can set
`service_account_credentials` with the actual contents of the file
instead, or set the equivalent environment variable.
2018-03-17 00:51:19 +01:00
2021-10-14 15:40:18 +02:00
#### Use case - Google Apps/G-suite account and individual Drive
2018-03-17 00:51:19 +01:00
Let's say that you are the administrator of a Google Apps (old) or
G-suite account.
The goal is to store data on an individual's Drive account, who IS
a member of the domain.
We'll call the domain **example.com** , and the user
**foo@example.com**.
There's a few steps we need to go through to accomplish this:
2021-10-14 15:40:18 +02:00
##### 1. Create a service account for example.com
2018-03-17 00:51:19 +01:00
- To create a service account and obtain its credentials, go to the
[Google Developer Console ](https://console.developers.google.com ).
- You must have a project - create one if you don't.
- Then go to "IAM & admin" -> "Service Accounts".
- Use the "Create Credentials" button. Fill in "Service account name"
with something that identifies your client. "Role" can be empty.
- Tick "Furnish a new private key" - select "Key type JSON".
- Tick "Enable G Suite Domain-wide Delegation". This option makes
"impersonation" possible, as documented here:
[Delegating domain-wide authority to the service account ](https://developers.google.com/identity/protocols/OAuth2ServiceAccount#delegatingauthority )
- These credentials are what rclone will use for authentication.
If you ever need to remove access, press the "Delete service
account key" button.
2021-10-14 15:40:18 +02:00
##### 2. Allowing API access to example.com Google Drive
2018-03-17 00:51:19 +01:00
- Go to example.com's admin console
- Go into "Security" (or use the search bar)
- Select "Show more" and then "Advanced settings"
- Select "Manage API client access" in the "Authentication" section
- In the "Client Name" field enter the service account's
"Client ID" - this can be found in the Developer Console under
"IAM & Admin" -> "Service Accounts", then "View Client ID" for
the newly created service account.
It is a ~21 character numerical string.
- In the next field, "One or More API Scopes", enter
`https://www.googleapis.com/auth/drive`
to grant access to Google Drive specifically.
2021-10-14 15:40:18 +02:00
##### 3. Configure rclone, assuming a new install
2018-03-17 00:51:19 +01:00
```
rclone config
n/s/q> n # New
name>gdrive # Gdrive is an example name
Storage> # Select the number shown for Google Drive
client_id> # Can be left blank
client_secret> # Can be left blank
scope> # Select your scope, 1 for example
root_folder_id> # Can be left blank
service_account_file> /home/foo/myJSONfile.json # This is where the JSON file goes!
2021-08-01 16:17:07 +02:00
y/n> # Auto config, n
2018-03-17 00:51:19 +01:00
```
2021-10-14 15:40:18 +02:00
##### 4. Verify that it's working
2018-03-17 00:51:19 +01:00
- `rclone -v --drive-impersonate foo@example.com lsf gdrive:backup`
- The arguments do:
- `-v` - verbose logging
- `--drive-impersonate foo@example.com` - this is what does
the magic, pretending to be user foo.
- `lsf` - list files in a parsing friendly way
- `gdrive:backup` - use the remote called gdrive, work in
the folder named backup.
2017-11-29 22:34:19 +01:00
2020-07-27 18:10:28 +02:00
Note: in case you configured a specific root folder on gdrive and rclone is unable to access the contents of that folder when using `--drive-impersonate` , do this instead:
- in the gdrive web interface, share your root folder with the user/email of the new Service Account you created/selected at step #1
- use rclone without specifying the `--drive-impersonate` option, like this:
2021-08-10 21:59:36 +02:00
`rclone -v lsf gdrive:backup`
2020-07-27 18:10:28 +02:00
2021-10-14 15:40:18 +02:00
### Shared drives (team drives)
2017-06-01 21:12:11 +02:00
2021-02-07 12:38:17 +01:00
If you want to configure the remote to point to a Google Shared Drive
(previously known as Team Drives) then answer `y` to the question
`Configure this as a Shared Drive (Team Drive)?` .
2017-06-01 21:12:11 +02:00
2021-02-07 12:38:17 +01:00
This will fetch the list of Shared Drives from google and allow you to
configure which one you want to use. You can also type in a Shared
Drive ID if you prefer.
2017-06-01 21:12:11 +02:00
For example:
```
2021-02-07 12:38:17 +01:00
Configure this as a Shared Drive (Team Drive)?
2017-06-01 21:12:11 +02:00
y) Yes
n) No
y/n> y
2021-02-07 12:38:17 +01:00
Fetching Shared Drive list...
2017-06-01 21:12:11 +02:00
Choose a number from below, or type in your own value
1 / Rclone Test
\ "xxxxxxxxxxxxxxxxxxxx"
2 / Rclone Test 2
\ "yyyyyyyyyyyyyyyyyyyy"
3 / Rclone Test 3
\ "zzzzzzzzzzzzzzzzzzzz"
2021-02-07 12:38:17 +01:00
Enter a Shared Drive ID> 1
2017-06-01 21:12:11 +02:00
--------------------
[remote]
2017-09-01 19:54:14 +02:00
client_id =
client_secret =
2017-06-01 21:12:11 +02:00
token = {"AccessToken":"xxxx.x.xxxxx_xxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","RefreshToken":"1/xxxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxx","Expiry":"2014-03-16T13:57:58.955387075Z","Extra":null}
team_drive = xxxxxxxxxxxxxxxxxxxx
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y
```
2021-10-14 15:40:18 +02:00
### --fast-list
2018-08-06 22:38:50 +02:00
This remote supports `--fast-list` which allows you to use fewer
transactions in exchange for more memory. See the [rclone
docs](/docs/#fast-list) for more details.
It does this by combining multiple `list` calls into a single API request.
This works by combining many `'%s' in parents` filters into one expression.
2019-03-27 20:12:24 +01:00
To list the contents of directories a, b and c, the following requests will be send by the regular `List` function:
2018-08-06 22:38:50 +02:00
```
trashed=false and 'a' in parents
trashed=false and 'b' in parents
trashed=false and 'c' in parents
```
These can now be combined into a single request:
```
trashed=false and ('a' in parents or 'b' in parents or 'c' in parents)
```
The implementation of `ListR` will put up to 50 `parents` filters into one request.
It will use the `--checkers` value to specify the number of requests to run in parallel.
In tests, these batch requests were up to 20x faster than the regular method.
Running the following command against different sized folders gives:
```
rclone lsjson -vv -R --checkers=6 gdrive:folder
```
small folder (220 directories, 700 files):
- without `--fast-list` : 38s
- with `--fast-list` : 10s
large folder (10600 directories, 39000 files):
- without `--fast-list` : 22:05 min
- with `--fast-list` : 58s
2021-10-14 15:40:18 +02:00
### Modified time
2014-03-28 23:34:13 +01:00
Google drive stores modification times accurate to 1 ms.
2015-05-10 13:17:24 +02:00
2021-10-14 15:40:18 +02:00
### Restricted filename characters
2018-11-02 13:13:24 +01:00
Only Invalid UTF-8 bytes will be [replaced ](/overview/#invalid-utf8 ),
as they can't be used in JSON strings.
In contrast to other backends, `/` can also be used in names and `.`
or `..` are valid names.
2021-10-14 15:40:18 +02:00
### Revisions
2015-05-10 13:17:24 +02:00
Google drive stores revisions of files. When you upload a change to
an existing file to google drive using rclone it will create a new
revision of that file.
Revisions follow the standard google policy which at time of writing
was
* They are deleted after 30 days or 100 revisions (whatever comes first).
* They do not count towards a user storage quota.
2015-05-21 19:39:46 +02:00
2021-10-14 15:40:18 +02:00
### Deleting files
2015-08-16 15:49:58 +02:00
2017-09-15 12:58:50 +02:00
By default rclone will send all files to the trash when deleting
files. If deleting them permanently is required then use the
`--drive-use-trash=false` flag, or set the equivalent environment
variable.
2015-08-16 15:49:58 +02:00
2021-10-14 15:40:18 +02:00
### Shortcuts
2020-04-12 17:55:11 +02:00
In March 2020 Google introduced a new feature in Google Drive called
[drive shortcuts ](https://support.google.com/drive/answer/9700156 )
([API](https://developers.google.com/drive/api/v3/shortcuts)). These
will (by September 2020) [replace the ability for files or folders to
be in multiple folders at once](https://cloud.google.com/blog/products/g-suite/simplifying-google-drives-folder-structure-and-sharing-models).
Shortcuts are files that link to other files on Google Drive somewhat
like a symlink in unix, except they point to the underlying file data
2020-10-13 23:49:58 +02:00
(e.g. the inode in unix terms) so they don't break if the source is
2020-04-12 17:55:11 +02:00
renamed or moved about.
Be default rclone treats these as follows.
For shortcuts pointing to files:
- When listing a file shortcut appears as the destination file.
- When downloading the contents of the destination file is downloaded.
- When updating shortcut file with a non shortcut file, the shortcut is removed then a new file is uploaded in place of the shortcut.
2020-10-13 23:43:40 +02:00
- When server-side moving (renaming) the shortcut is renamed, not the destination file.
2022-02-04 12:37:58 +01:00
- When server-side copying the shortcut is copied, not the contents of the shortcut. (unless `--drive-copy-shortcut-content` is in use in which case the contents of the shortcut gets copied).
2020-04-12 17:55:11 +02:00
- When deleting the shortcut is deleted not the linked file.
- When setting the modification time, the modification time of the linked file will be set.
For shortcuts pointing to folders:
- When listing the shortcut appears as a folder and that folder will contain the contents of the linked folder appear (including any sub folders)
- When downloading the contents of the linked folder and sub contents are downloaded
- When uploading to a shortcut folder the file will be placed in the linked folder
2020-10-13 23:43:40 +02:00
- When server-side moving (renaming) the shortcut is renamed, not the destination folder
- When server-side copying the contents of the linked folder is copied, not the shortcut.
2020-04-12 17:55:11 +02:00
- When deleting with `rclone rmdir` or `rclone purge` the shortcut is deleted not the linked folder.
- **NB** When deleting with `rclone remove` or `rclone mount` the contents of the linked folder will be deleted.
2020-05-27 17:23:27 +02:00
The [rclone backend ](https://rclone.org/commands/rclone_backend/ ) command can be used to create shortcuts.
2020-04-12 17:55:11 +02:00
Shortcuts can be completely ignored with the `--drive-skip-shortcuts` flag
or the corresponding `skip_shortcuts` configuration setting.
2021-10-14 15:40:18 +02:00
### Emptying trash
2017-09-01 19:54:14 +02:00
If you wish to empty your trash you can use the `rclone cleanup remote:`
command which will permanently delete all your trashed files. This command
does not take any path arguments.
2019-05-22 21:48:59 +02:00
Note that Google Drive takes some time (minutes to days) to empty the
trash even though the command returns within a few seconds. No output
is echoed, so there will be no confirmation even using -v or -vv.
2021-10-14 15:40:18 +02:00
### Quota information
2018-02-09 21:48:32 +01:00
To view your current quota you can use the `rclone about remote:`
command which will display your usage limit (quota), the usage in Google
Drive, the size of all files in the Trash and the space used by other
Google services such as Gmail. This command does not take any path
arguments.
2021-10-14 15:40:18 +02:00
#### Import/Export of google documents
2016-01-26 17:52:53 +01:00
2018-08-19 16:16:11 +02:00
Google documents can be exported from and uploaded to Google Drive.
2016-01-26 17:52:53 +01:00
2018-08-19 16:16:11 +02:00
When rclone downloads a Google doc it chooses a format to download
depending upon the `--drive-export-formats` setting.
By default the export formats are `docx,xlsx,pptx,svg` which are a
sensible default for an editable document.
2016-01-26 17:52:53 +01:00
When choosing a format, rclone runs down the list provided in order
and chooses the first file format the doc can be exported as from the
list. If the file can't be exported to a format on the formats list,
then rclone will choose a format from the default list.
2018-08-19 16:16:11 +02:00
If you prefer an archive copy then you might use `--drive-export-formats
2016-01-26 17:52:53 +01:00
pdf`, or if you prefer openoffice/libreoffice formats you might use
2018-08-19 16:16:11 +02:00
`--drive-export-formats ods,odt,odp` .
2016-01-26 17:52:53 +01:00
Note that rclone adds the extension to the google doc, so if it is
2019-03-27 20:12:24 +01:00
called `My Spreadsheet` on google docs, it will be exported as `My
2016-01-26 17:52:53 +01:00
Spreadsheet.xlsx` or `My Spreadsheet.pdf` etc.
2019-04-16 22:25:33 +02:00
When importing files into Google Drive, rclone will convert all
2018-08-19 16:16:11 +02:00
files with an extension in `--drive-import-formats` to their
associated document type.
rclone will not convert any files by default, since the conversion
is lossy process.
The conversion must result in a file with the same extension when
2019-03-27 20:12:24 +01:00
the `--drive-export-formats` rules are applied to the uploaded document.
2018-08-19 16:16:11 +02:00
Here are some examples for allowed and prohibited conversions.
| export-formats | import-formats | Upload Ext | Document Ext | Allowed |
| -------------- | -------------- | ---------- | ------------ | ------- |
| odt | odt | odt | odt | Yes |
| odt | docx,odt | odt | odt | Yes |
| | docx | docx | docx | Yes |
| | odt | odt | docx | No |
| odt,docx | docx,odt | docx | odt | No |
| docx,odt | docx,odt | docx | docx | Yes |
| docx,odt | docx,odt | odt | docx | No |
This limitation can be disabled by specifying `--drive-allow-import-name-change` .
When using this flag, rclone can convert multiple files types resulting
2020-10-13 23:49:58 +02:00
in the same document type at once, e.g. with `--drive-import-formats docx,odt,txt` ,
2019-03-27 20:12:24 +01:00
all files having these extension would result in a document represented as a docx file.
2018-08-19 16:16:11 +02:00
This brings the additional risk of overwriting a document, if multiple files
have the same stem. Many rclone operations will not handle this name change
in any way. They assume an equal name when copying files and might copy the
file again or delete them when the name changes.
Here are the possible export extensions with their corresponding mime types.
Most of these can also be used for importing, but there more that are not
listed here. Some of these additional ones might only be available when
the operating system provides the correct MIME type entries.
This list can be changed by Google Drive at any time and might not
2019-03-27 20:12:24 +01:00
represent the currently available conversions.
2016-01-26 17:52:53 +01:00
| Extension | Mime Type | Description |
| --------- |-----------| ------------|
2022-06-20 12:39:45 +02:00
| bmp | image/bmp | Windows Bitmap format |
2016-01-26 17:52:53 +01:00
| csv | text/csv | Standard CSV format for Spreadsheets |
2022-06-20 12:39:45 +02:00
| doc | application/msword | Classic Word file |
2016-01-26 17:52:53 +01:00
| docx | application/vnd.openxmlformats-officedocument.wordprocessingml.document | Microsoft Office Document |
2016-09-19 19:08:10 +02:00
| epub | application/epub+zip | E-book format |
2016-01-26 17:52:53 +01:00
| html | text/html | An HTML Document |
| jpg | image/jpeg | A JPEG Image File |
2022-06-20 12:39:45 +02:00
| json | application/vnd.google-apps.script+json | JSON Text Format for Google Apps scripts |
2017-01-09 06:09:19 +01:00
| odp | application/vnd.oasis.opendocument.presentation | Openoffice Presentation |
2016-01-26 17:52:53 +01:00
| ods | application/vnd.oasis.opendocument.spreadsheet | Openoffice Spreadsheet |
| ods | application/x-vnd.oasis.opendocument.spreadsheet | Openoffice Spreadsheet |
| odt | application/vnd.oasis.opendocument.text | Openoffice Document |
| pdf | application/pdf | Adobe PDF Format |
2022-06-20 12:39:45 +02:00
| pjpeg | image/pjpeg | Progressive JPEG Image |
2016-01-26 17:52:53 +01:00
| png | image/png | PNG Image Format|
| pptx | application/vnd.openxmlformats-officedocument.presentationml.presentation | Microsoft Office Powerpoint |
| rtf | application/rtf | Rich Text Format |
| svg | image/svg+xml | Scalable Vector Graphics Format |
2016-09-19 19:08:10 +02:00
| tsv | text/tab-separated-values | Standard TSV format for spreadsheets |
2016-01-26 17:52:53 +01:00
| txt | text/plain | Plain Text |
2022-06-20 12:39:45 +02:00
| wmf | application/x-msmetafile | Windows Meta File |
| xls | application/vnd.ms-excel | Classic Excel file |
2016-01-26 17:52:53 +01:00
| xlsx | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | Microsoft Office Spreadsheet |
| zip | application/zip | A ZIP file of HTML, Images CSS |
2019-03-27 20:12:24 +01:00
Google documents can also be exported as link files. These files will
open a browser window for the Google Docs website of that document
2018-08-21 12:51:36 +02:00
when opened. The link file extension has to be specified as a
`--drive-export-formats` parameter. They will match all available
Google Documents.
| Extension | Description | OS Support |
| --------- | ----------- | ---------- |
| desktop | freedesktop.org specified desktop entry | Linux |
| link.html | An HTML Document with a redirect | All |
| url | INI style link file | macOS, Windows |
| webloc | macOS specific XML format | macOS |
2020-05-22 13:22:52 +02:00
{{< rem autogenerated options start " - DO NOT EDIT - instead edit fs . RegInfo in backend / drive / drive . go then run make backenddocs " > }}
2021-11-01 16:42:05 +01:00
### Standard options
2018-10-01 21:48:54 +02:00
2022-07-09 19:08:20 +02:00
Here are the Standard options specific to drive (Google Drive).
2018-10-01 21:48:54 +02:00
#### --drive-client-id
2021-02-02 14:42:35 +01:00
Google Application Client Id
Setting your own is recommended.
See https://rclone.org/drive/#making-your-own-client-id for how to create your own.
If you leave this blank, it will use an internal key which is low performance.
2018-10-01 21:48:54 +02:00
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: client_id
- Env Var: RCLONE_DRIVE_CLIENT_ID
- Type: string
2022-03-18 13:29:54 +01:00
- Required: false
2018-10-01 21:48:54 +02:00
#### --drive-client-secret
2021-11-01 16:42:05 +01:00
OAuth Client Secret.
2020-09-02 17:59:04 +02:00
Leave blank normally.
2018-10-01 21:48:54 +02:00
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: client_secret
- Env Var: RCLONE_DRIVE_CLIENT_SECRET
- Type: string
2022-03-18 13:29:54 +01:00
- Required: false
2018-10-01 21:48:54 +02:00
#### --drive-scope
Scope that rclone should use when requesting access from drive.
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: scope
- Env Var: RCLONE_DRIVE_SCOPE
- Type: string
2022-03-18 13:29:54 +01:00
- Required: false
2018-10-01 21:48:54 +02:00
- Examples:
- "drive"
- Full access all files, excluding Application Data Folder.
- "drive.readonly"
- Read-only access to file metadata and file contents.
- "drive.file"
- Access to files created by rclone only.
- These are visible in the drive website.
- File authorization is revoked when the user deauthorizes the app.
- "drive.appfolder"
- Allows read and write access to the Application Data folder.
- This is not visible in the drive website.
- "drive.metadata.readonly"
- Allows read-only access to file metadata but
- does not allow any access to read or download file content.
#### --drive-service-account-file
2021-11-01 16:42:05 +01:00
Service Account Credentials JSON file path.
2018-10-01 21:48:54 +02:00
Leave blank normally.
Needed only if you want use SA instead of interactive login.
2020-09-02 17:59:04 +02:00
Leading `~` will be expanded in the file name as will environment variables such as `${RCLONE_CONFIG_DIR}` .
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: service_account_file
- Env Var: RCLONE_DRIVE_SERVICE_ACCOUNT_FILE
- Type: string
2022-03-18 13:29:54 +01:00
- Required: false
2018-10-01 21:48:54 +02:00
2020-09-02 17:59:04 +02:00
#### --drive-alternate-export
2021-11-01 16:42:05 +01:00
Deprecated: No longer needed.
2020-09-02 17:59:04 +02:00
2022-03-18 13:29:54 +01:00
Properties:
2020-09-02 17:59:04 +02:00
- Config: alternate_export
- Env Var: RCLONE_DRIVE_ALTERNATE_EXPORT
- Type: bool
- Default: false
2021-11-01 16:42:05 +01:00
### Advanced options
2018-10-01 21:48:54 +02:00
2022-07-09 19:08:20 +02:00
Here are the Advanced options specific to drive (Google Drive).
2018-10-01 21:48:54 +02:00
2020-09-02 17:59:04 +02:00
#### --drive-token
OAuth Access Token as a JSON blob.
2022-03-18 13:29:54 +01:00
Properties:
2020-09-02 17:59:04 +02:00
- Config: token
- Env Var: RCLONE_DRIVE_TOKEN
- Type: string
2022-03-18 13:29:54 +01:00
- Required: false
2020-09-02 17:59:04 +02:00
#### --drive-auth-url
Auth server URL.
2021-11-01 16:42:05 +01:00
2020-09-02 17:59:04 +02:00
Leave blank to use the provider defaults.
2022-03-18 13:29:54 +01:00
Properties:
2020-09-02 17:59:04 +02:00
- Config: auth_url
- Env Var: RCLONE_DRIVE_AUTH_URL
- Type: string
2022-03-18 13:29:54 +01:00
- Required: false
2020-09-02 17:59:04 +02:00
#### --drive-token-url
Token server url.
2021-11-01 16:42:05 +01:00
2020-09-02 17:59:04 +02:00
Leave blank to use the provider defaults.
2022-03-18 13:29:54 +01:00
Properties:
2020-09-02 17:59:04 +02:00
- Config: token_url
- Env Var: RCLONE_DRIVE_TOKEN_URL
- Type: string
2022-03-18 13:29:54 +01:00
- Required: false
2020-09-02 17:59:04 +02:00
2022-07-09 19:08:20 +02:00
#### --drive-root-folder-id
ID of the root folder.
Leave blank normally.
Fill in to access "Computers" folders (see docs), or for rclone to use
a non root folder as its starting point.
Properties:
- Config: root_folder_id
- Env Var: RCLONE_DRIVE_ROOT_FOLDER_ID
- Type: string
- Required: false
2018-10-01 21:48:54 +02:00
#### --drive-service-account-credentials
2021-11-01 16:42:05 +01:00
Service Account Credentials JSON blob.
2018-10-01 21:48:54 +02:00
Leave blank normally.
Needed only if you want use SA instead of interactive login.
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: service_account_credentials
- Env Var: RCLONE_DRIVE_SERVICE_ACCOUNT_CREDENTIALS
- Type: string
2022-03-18 13:29:54 +01:00
- Required: false
2018-10-01 21:48:54 +02:00
#### --drive-team-drive
2021-11-01 16:42:05 +01:00
ID of the Shared Drive (Team Drive).
2018-10-01 21:48:54 +02:00
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: team_drive
- Env Var: RCLONE_DRIVE_TEAM_DRIVE
- Type: string
2022-03-18 13:29:54 +01:00
- Required: false
2018-10-01 21:48:54 +02:00
#### --drive-auth-owner-only
Only consider files owned by the authenticated user.
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: auth_owner_only
- Env Var: RCLONE_DRIVE_AUTH_OWNER_ONLY
- Type: bool
- Default: false
#### --drive-use-trash
Send files to the trash instead of deleting permanently.
2021-11-01 16:42:05 +01:00
2018-10-01 21:48:54 +02:00
Defaults to true, namely sending files to the trash.
Use `--drive-use-trash=false` to delete files permanently instead.
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: use_trash
- Env Var: RCLONE_DRIVE_USE_TRASH
- Type: bool
- Default: true
2022-03-18 13:29:54 +01:00
#### --drive-copy-shortcut-content
Server side copy contents of shortcuts instead of the shortcut.
When doing server side copies, normally rclone will copy shortcuts as
shortcuts.
If this flag is used then rclone will copy the contents of shortcuts
rather than shortcuts themselves when doing server side copies.
Properties:
- Config: copy_shortcut_content
- Env Var: RCLONE_DRIVE_COPY_SHORTCUT_CONTENT
- Type: bool
- Default: false
2018-10-01 21:48:54 +02:00
#### --drive-skip-gdocs
Skip google documents in all listings.
2021-11-01 16:42:05 +01:00
2018-10-01 21:48:54 +02:00
If given, gdocs practically become invisible to rclone.
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: skip_gdocs
- Env Var: RCLONE_DRIVE_SKIP_GDOCS
- Type: bool
- Default: false
2019-04-13 12:01:58 +02:00
#### --drive-skip-checksum-gphotos
Skip MD5 checksum on Google photos and videos only.
Use this if you get checksum errors when transferring Google photos or
videos.
Setting this flag will cause Google photos and videos to return a
blank MD5 checksum.
2020-05-27 17:11:47 +02:00
Google photos are identified by being in the "photos" space.
2019-04-13 12:01:58 +02:00
Corrupted checksums are caused by Google modifying the image/video but
not updating the checksum.
2022-03-18 13:29:54 +01:00
Properties:
2019-04-13 12:01:58 +02:00
- Config: skip_checksum_gphotos
- Env Var: RCLONE_DRIVE_SKIP_CHECKSUM_GPHOTOS
- Type: bool
- Default: false
2018-10-01 21:48:54 +02:00
#### --drive-shared-with-me
Only show files that are shared with me.
Instructs rclone to operate on your "Shared with me" folder (where
Google Drive lets you access the files and folders others have shared
with you).
2020-10-14 00:07:12 +02:00
This works both with the "list" (lsd, lsl, etc.) and the "copy"
commands (copy, sync, etc.), and with all other commands too.
2018-10-01 21:48:54 +02:00
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: shared_with_me
- Env Var: RCLONE_DRIVE_SHARED_WITH_ME
- Type: bool
- Default: false
#### --drive-trashed-only
Only show files that are in the trash.
2021-11-01 16:42:05 +01:00
2018-10-01 21:48:54 +02:00
This will show trashed files in their original directory structure.
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: trashed_only
- Env Var: RCLONE_DRIVE_TRASHED_ONLY
- Type: bool
- Default: false
2020-09-02 17:59:04 +02:00
#### --drive-starred-only
Only show files that are starred.
2022-03-18 13:29:54 +01:00
Properties:
2020-09-02 17:59:04 +02:00
- Config: starred_only
- Env Var: RCLONE_DRIVE_STARRED_ONLY
- Type: bool
- Default: false
2018-10-01 21:48:54 +02:00
#### --drive-formats
2021-11-01 16:42:05 +01:00
Deprecated: See export_formats.
2018-10-01 21:48:54 +02:00
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: formats
- Env Var: RCLONE_DRIVE_FORMATS
- Type: string
2022-03-18 13:29:54 +01:00
- Required: false
2018-10-01 21:48:54 +02:00
#### --drive-export-formats
Comma separated list of preferred formats for downloading Google docs.
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: export_formats
- Env Var: RCLONE_DRIVE_EXPORT_FORMATS
- Type: string
- Default: "docx,xlsx,pptx,svg"
#### --drive-import-formats
Comma separated list of preferred formats for uploading Google docs.
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: import_formats
- Env Var: RCLONE_DRIVE_IMPORT_FORMATS
- Type: string
2022-03-18 13:29:54 +01:00
- Required: false
2018-10-01 21:48:54 +02:00
#### --drive-allow-import-name-change
2021-11-01 16:42:05 +01:00
Allow the filetype to change when uploading Google docs.
E.g. file.doc to file.docx. This will confuse sync and reupload every time.
2018-10-01 21:48:54 +02:00
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: allow_import_name_change
- Env Var: RCLONE_DRIVE_ALLOW_IMPORT_NAME_CHANGE
- Type: bool
- Default: false
#### --drive-use-created-date
2021-11-01 16:42:05 +01:00
Use file created date instead of modified date.
2018-10-01 21:48:54 +02:00
Useful when downloading data and you want the creation date used in
place of the last modified date.
**WARNING**: This flag may have some unexpected consequences.
When uploading to your drive all files will be overwritten unless they
haven't been modified since their creation. And the inverse will occur
while downloading. This side effect can be avoided by using the
"--checksum" flag.
This feature was implemented to retain photos capture date as recorded
by google photos. You will first need to check the "Create a Google
Photos folder" option in your google drive settings. You can then copy
or move the photos locally and use the date the image was taken
(created) set as the modification date.
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: use_created_date
- Env Var: RCLONE_DRIVE_USE_CREATED_DATE
- Type: bool
- Default: false
2020-02-01 11:31:42 +01:00
#### --drive-use-shared-date
Use date file was shared instead of modified date.
Note that, as with "--drive-use-created-date", this flag may have
unexpected consequences when uploading/downloading files.
If both this flag and "--drive-use-created-date" are set, the created
date is used.
2022-03-18 13:29:54 +01:00
Properties:
2020-02-01 11:31:42 +01:00
- Config: use_shared_date
- Env Var: RCLONE_DRIVE_USE_SHARED_DATE
- Type: bool
- Default: false
2018-10-01 21:48:54 +02:00
#### --drive-list-chunk
2021-11-01 16:42:05 +01:00
Size of listing chunk 100-1000, 0 to disable.
2018-10-01 21:48:54 +02:00
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: list_chunk
- Env Var: RCLONE_DRIVE_LIST_CHUNK
- Type: int
- Default: 1000
#### --drive-impersonate
Impersonate this user when using a service account.
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: impersonate
- Env Var: RCLONE_DRIVE_IMPERSONATE
- Type: string
2022-03-18 13:29:54 +01:00
- Required: false
2018-10-01 21:48:54 +02:00
#### --drive-upload-cutoff
2021-11-01 16:42:05 +01:00
Cutoff for switching to chunked upload.
2018-10-01 21:48:54 +02:00
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: upload_cutoff
- Env Var: RCLONE_DRIVE_UPLOAD_CUTOFF
- Type: SizeSuffix
2021-07-20 20:45:41 +02:00
- Default: 8Mi
2018-10-01 21:48:54 +02:00
#### --drive-chunk-size
2021-11-01 16:42:05 +01:00
Upload chunk size.
Must a power of 2 >= 256k.
2018-10-01 21:48:54 +02:00
Making this larger will improve performance, but note that each chunk
is buffered in memory one per transfer.
Reducing this will reduce memory usage but decrease performance.
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: chunk_size
- Env Var: RCLONE_DRIVE_CHUNK_SIZE
- Type: SizeSuffix
2021-07-20 20:45:41 +02:00
- Default: 8Mi
2018-10-01 21:48:54 +02:00
#### --drive-acknowledge-abuse
Set to allow files which return cannotDownloadAbusiveFile to be downloaded.
If downloading a file returns the error "This file has been identified
as malware or spam and cannot be downloaded" with the error code
"cannotDownloadAbusiveFile" then supply this flag to rclone to
indicate you acknowledge the risks of downloading the file and rclone
will download it anyway.
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: acknowledge_abuse
- Env Var: RCLONE_DRIVE_ACKNOWLEDGE_ABUSE
- Type: bool
- Default: false
#### --drive-keep-revision-forever
Keep new head revision of each file forever.
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: keep_revision_forever
- Env Var: RCLONE_DRIVE_KEEP_REVISION_FOREVER
- Type: bool
- Default: false
2019-06-15 13:01:29 +02:00
#### --drive-size-as-quota
2020-02-01 11:31:42 +01:00
Show sizes as storage quota usage, not actual size.
2020-05-19 13:02:44 +02:00
Show the size of a file as the storage quota used. This is the
2020-02-01 11:31:42 +01:00
current version plus any older versions that have been set to keep
forever.
**WARNING**: This flag may have some unexpected consequences.
It is not recommended to set this flag in your config - the
recommended usage is using the flag form --drive-size-as-quota when
doing rclone ls/lsl/lsf/lsjson/etc only.
2019-06-15 13:01:29 +02:00
2020-02-01 11:31:42 +01:00
If you do use this flag for syncing (not recommended) then you will
need to use --ignore size also.
2019-06-15 13:01:29 +02:00
2022-03-18 13:29:54 +01:00
Properties:
2019-06-15 13:01:29 +02:00
- Config: size_as_quota
- Env Var: RCLONE_DRIVE_SIZE_AS_QUOTA
- Type: bool
- Default: false
2018-10-01 21:48:54 +02:00
#### --drive-v2-download-min-size
If Object's are greater, use drive v2 API to download.
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: v2_download_min_size
- Env Var: RCLONE_DRIVE_V2_DOWNLOAD_MIN_SIZE
- Type: SizeSuffix
- Default: off
2019-02-09 11:42:57 +01:00
#### --drive-pacer-min-sleep
Minimum time to sleep between API calls.
2022-03-18 13:29:54 +01:00
Properties:
2019-02-09 11:42:57 +01:00
- Config: pacer_min_sleep
- Env Var: RCLONE_DRIVE_PACER_MIN_SLEEP
- Type: Duration
- Default: 100ms
#### --drive-pacer-burst
Number of API calls to allow without sleeping.
2022-03-18 13:29:54 +01:00
Properties:
2019-02-09 11:42:57 +01:00
- Config: pacer_burst
- Env Var: RCLONE_DRIVE_PACER_BURST
- Type: int
- Default: 100
2019-06-15 13:01:29 +02:00
#### --drive-server-side-across-configs
2020-10-13 23:49:58 +02:00
Allow server-side operations (e.g. copy) to work across different drive configs.
2019-06-15 13:01:29 +02:00
2020-10-13 23:43:40 +02:00
This can be useful if you wish to do a server-side copy between two
2019-06-15 13:01:29 +02:00
different Google drives. Note that this isn't enabled by default
2019-10-26 12:04:54 +02:00
because it isn't easy to tell if it will work between any two
2019-06-15 13:01:29 +02:00
configurations.
2022-03-18 13:29:54 +01:00
Properties:
2019-06-15 13:01:29 +02:00
- Config: server_side_across_configs
- Env Var: RCLONE_DRIVE_SERVER_SIDE_ACROSS_CONFIGS
- Type: bool
- Default: false
2019-10-26 12:04:54 +02:00
#### --drive-disable-http2
2021-11-01 16:42:05 +01:00
Disable drive using http2.
2019-10-26 12:04:54 +02:00
There is currently an unsolved issue with the google drive backend and
HTTP/2. HTTP/2 is therefore disabled by default for the drive backend
but can be re-enabled here. When the issue is solved this flag will
be removed.
See: https://github.com/rclone/rclone/issues/3631
2022-03-18 13:29:54 +01:00
Properties:
2019-10-26 12:04:54 +02:00
- Config: disable_http2
- Env Var: RCLONE_DRIVE_DISABLE_HTTP2
- Type: bool
- Default: true
2020-02-01 11:31:42 +01:00
#### --drive-stop-on-upload-limit
2021-11-01 16:42:05 +01:00
Make upload limit errors be fatal.
2020-02-01 11:31:42 +01:00
2021-03-02 20:11:57 +01:00
At the time of writing it is only possible to upload 750 GiB of data to
2020-02-01 11:31:42 +01:00
Google Drive a day (this is an undocumented limit). When this limit is
reached Google Drive produces a slightly different error message. When
this flag is set it causes these errors to be fatal. These will stop
the in-progress sync.
Note that this detection is relying on error message strings which
Google don't document so it may break in the future.
See: https://github.com/rclone/rclone/issues/3857
2022-03-18 13:29:54 +01:00
Properties:
2020-02-01 11:31:42 +01:00
- Config: stop_on_upload_limit
- Env Var: RCLONE_DRIVE_STOP_ON_UPLOAD_LIMIT
- Type: bool
- Default: false
2021-02-02 14:42:35 +01:00
#### --drive-stop-on-download-limit
2021-11-01 16:42:05 +01:00
Make download limit errors be fatal.
2021-02-02 14:42:35 +01:00
2021-03-02 20:11:57 +01:00
At the time of writing it is only possible to download 10 TiB of data from
2021-02-02 14:42:35 +01:00
Google Drive a day (this is an undocumented limit). When this limit is
reached Google Drive produces a slightly different error message. When
this flag is set it causes these errors to be fatal. These will stop
the in-progress sync.
Note that this detection is relying on error message strings which
Google don't document so it may break in the future.
2022-03-18 13:29:54 +01:00
Properties:
2021-02-02 14:42:35 +01:00
- Config: stop_on_download_limit
- Env Var: RCLONE_DRIVE_STOP_ON_DOWNLOAD_LIMIT
- Type: bool
- Default: false
2020-04-12 17:55:11 +02:00
#### --drive-skip-shortcuts
2021-11-01 16:42:05 +01:00
If set skip shortcut files.
2020-04-12 17:55:11 +02:00
Normally rclone dereferences shortcut files making them appear as if
they are the original file (see [the shortcuts section ](#shortcuts )).
If this flag is set then rclone will ignore shortcut files completely.
2022-03-18 13:29:54 +01:00
Properties:
2020-04-12 17:55:11 +02:00
- Config: skip_shortcuts
- Env Var: RCLONE_DRIVE_SKIP_SHORTCUTS
- Type: bool
- Default: false
2022-03-18 13:29:54 +01:00
#### --drive-skip-dangling-shortcuts
If set skip dangling shortcut files.
If this is set then rclone will not show any dangling shortcuts in listings.
Properties:
- Config: skip_dangling_shortcuts
- Env Var: RCLONE_DRIVE_SKIP_DANGLING_SHORTCUTS
- Type: bool
- Default: false
2022-07-09 19:08:20 +02:00
#### --drive-resource-key
Resource key for accessing a link-shared file.
If you need to access files shared with a link like this
https://drive.google.com/drive/folders/XXX?resourcekey=YYY& usp=sharing
Then you will need to use the first part "XXX" as the "root_folder_id"
and the second part "YYY" as the "resource_key" otherwise you will get
404 not found errors when trying to access the directory.
See: https://developers.google.com/drive/api/guides/resource-keys
This resource key requirement only applies to a subset of old files.
Note also that opening the folder once in the web interface (with the
user you've authenticated rclone with) seems to be enough so that the
resource key is no needed.
Properties:
- Config: resource_key
- Env Var: RCLONE_DRIVE_RESOURCE_KEY
- Type: string
- Required: false
2020-02-01 11:31:42 +01:00
#### --drive-encoding
2022-03-18 13:29:54 +01:00
The encoding for the backend.
2020-02-01 11:31:42 +01:00
2021-11-01 16:42:05 +01:00
See the [encoding section in the overview ](/overview/#encoding ) for more info.
2020-02-01 11:31:42 +01:00
2022-03-18 13:29:54 +01:00
Properties:
2020-02-01 11:31:42 +01:00
- Config: encoding
- Env Var: RCLONE_DRIVE_ENCODING
- Type: MultiEncoder
- Default: InvalidUtf8
2021-11-01 16:42:05 +01:00
## Backend commands
2020-05-22 13:22:52 +02:00
Here are the commands specific to the drive backend.
2020-05-27 17:11:47 +02:00
Run them with
2020-05-22 13:22:52 +02:00
rclone backend COMMAND remote:
The help below will explain what arguments each command takes.
2022-07-09 19:08:20 +02:00
See the [backend ](/commands/rclone_backend/ ) command for more
2020-05-22 13:22:52 +02:00
info on how to pass options and arguments.
These can be run on a running backend using the rc command
2022-03-18 13:29:54 +01:00
[backend/command ](/rc/#backend-command ).
2020-05-22 13:22:52 +02:00
2021-11-01 16:42:05 +01:00
### get
2020-05-22 13:22:52 +02:00
Get command for fetching the drive config parameters
rclone backend get remote: [options] [< arguments > +]
This is a get command which will be used to fetch the various drive config parameters
Usage Examples:
rclone backend get drive: [-o service_account_file] [-o chunk_size]
rclone rc backend/command command=get fs=drive: [-o service_account_file] [-o chunk_size]
Options:
- "chunk_size": show the current upload chunk size
- "service_account_file": show the current service account file
2021-11-01 16:42:05 +01:00
### set
2020-05-22 13:22:52 +02:00
Set command for updating the drive config parameters
rclone backend set remote: [options] [< arguments > +]
This is a set command which will be used to update the various drive config parameters
Usage Examples:
rclone backend set drive: [-o service_account_file=sa.json] [-o chunk_size=67108864]
rclone rc backend/command command=set fs=drive: [-o service_account_file=sa.json] [-o chunk_size=67108864]
Options:
- "chunk_size": update the current upload chunk size
- "service_account_file": update the current service account file
2021-11-01 16:42:05 +01:00
### shortcut
2020-05-22 13:22:52 +02:00
Create shortcuts from files or directories
rclone backend shortcut remote: [options] [< arguments > +]
This command creates shortcuts from files or directories.
Usage:
rclone backend shortcut drive: source_item destination_shortcut
rclone backend shortcut drive: source_item -o target=drive2: destination_shortcut
In the first example this creates a shortcut from the "source_item"
which can be a file or a directory to the "destination_shortcut". The
"source_item" and the "destination_shortcut" should be relative paths
from "drive:"
In the second example this creates a shortcut from the "source_item"
relative to "drive:" to the "destination_shortcut" relative to
"drive2:". This may fail with a permission error if the user
authenticated with "drive2:" can't read files from "drive:".
Options:
- "target": optional target remote for the shortcut destination
2021-11-01 16:42:05 +01:00
### drives
2020-09-02 17:59:04 +02:00
2021-02-07 12:38:17 +01:00
List the Shared Drives available to this account
2020-09-02 17:59:04 +02:00
rclone backend drives remote: [options] [< arguments > +]
2021-02-07 12:38:17 +01:00
This command lists the Shared Drives (Team Drives) available to this
2020-09-02 17:59:04 +02:00
account.
Usage:
2021-11-01 16:42:05 +01:00
rclone backend [-o config] drives drive:
2020-09-02 17:59:04 +02:00
This will return a JSON list of objects like this
[
{
"id": "0ABCDEF-01234567890",
"kind": "drive#teamDrive",
"name": "My Drive"
},
{
"id": "0ABCDEFabcdefghijkl",
"kind": "drive#teamDrive",
"name": "Test Drive"
}
]
2021-11-01 16:42:05 +01:00
With the -o config parameter it will output the list in a format
suitable for adding to a config file to make aliases for all the
2022-07-09 19:08:20 +02:00
drives found and a combined drive.
2021-11-01 16:42:05 +01:00
[My Drive]
type = alias
remote = drive,team_drive=0ABCDEF-01234567890,root_folder_id=:
[Test Drive]
type = alias
remote = drive,team_drive=0ABCDEFabcdefghijkl,root_folder_id=:
2022-07-09 19:08:20 +02:00
[AllDrives]
type = combine
remote = "My Drive=My Drive:" "Test Drive=Test Drive:"
2021-11-01 16:42:05 +01:00
2022-07-09 19:08:20 +02:00
Adding this to the rclone config file will cause those team drives to
be accessible with the aliases shown. Any illegal charactes will be
substituted with "_" and duplicate names will have numbers suffixed.
It will also add a remote called AllDrives which shows all the shared
drives combined into one directory tree.
2020-09-02 17:59:04 +02:00
2021-11-01 16:42:05 +01:00
### untrash
2020-09-02 17:59:04 +02:00
Untrash files and directories
rclone backend untrash remote: [options] [< arguments > +]
This command untrashes all the files and directories in the directory
passed in recursively.
Usage:
This takes an optional directory to trash which make this easier to
use via the API.
rclone backend untrash drive:directory
rclone backend -i untrash drive:directory subdir
Use the -i flag to see what would be restored before restoring it.
Result:
{
"Untrashed": 17,
"Errors": 0
}
2021-11-01 16:42:05 +01:00
### copyid
2021-02-02 14:42:35 +01:00
Copy files by ID
rclone backend copyid remote: [options] [< arguments > +]
This command copies files by ID
Usage:
rclone backend copyid drive: ID path
rclone backend copyid drive: ID1 path1 ID2 path2
It copies the drive file with ID given to the path (an rclone path which
will be passed internally to rclone copyto). The ID and path pairs can be
repeated.
The path should end with a / to indicate copy the file as named to
this directory. If it doesn't end with a / then the last path
component will be used as the file name.
If the destination is a drive backend then server-side copying will be
attempted if possible.
Use the -i flag to see what would be copied before copying.
2022-07-09 19:08:20 +02:00
### exportformats
Dump the export formats for debug purposes
rclone backend exportformats remote: [options] [< arguments > +]
### importformats
Dump the import formats for debug purposes
rclone backend importformats remote: [options] [< arguments > +]
2020-05-22 13:22:52 +02:00
{{< rem autogenerated options stop > }}
2018-01-17 21:19:14 +01:00
2021-10-14 15:40:18 +02:00
## Limitations
2015-05-21 19:39:46 +02:00
Drive has quite a lot of rate limiting. This causes rclone to be
limited to transferring about 2 files per second only. Individual
2021-08-21 19:54:21 +02:00
files may be transferred much faster at 100s of MiB/s but lots of
2015-05-21 19:39:46 +02:00
small files can take a long time.
2016-08-24 23:06:41 +02:00
2017-08-07 22:10:03 +02:00
Server side copies are also subject to a separate rate limit. If you
see User rate limit exceeded errors, wait at least 24 hours and retry.
2020-10-13 23:43:40 +02:00
You can disable server-side copies with `--disable copy` to download
2017-08-07 22:10:03 +02:00
and upload the files if you prefer.
2017-07-24 12:06:10 +02:00
2021-10-14 15:40:18 +02:00
### Limitations of Google Docs
2018-01-31 17:15:30 +01:00
2022-04-11 16:27:53 +02:00
Google docs will appear as size -1 in `rclone ls` , `rclone ncdu` etc,
and as size 0 in anything which uses the VFS layer, e.g. `rclone mount`
and `rclone serve` . When calculating directory totals, e.g. in
`rclone size` and `rclone ncdu` , they will be counted in as empty
files.
2018-01-31 17:15:30 +01:00
This is because rclone can't find out the size of the Google docs
without downloading them.
Google docs will transfer correctly with `rclone sync` , `rclone copy`
etc as rclone knows to ignore the size when doing the transfer.
2019-09-14 14:11:21 +02:00
However an unfortunate consequence of this is that you may not be able
to download Google docs using `rclone mount` . If it doesn't work you
will get a 0 sized file. If you try again the doc may gain its
2020-05-19 13:02:44 +02:00
correct size and be downloadable. Whether it will work on not depends
2019-09-14 14:11:21 +02:00
on the application accessing the mount and the OS you are running -
experiment to find out if it does work for you!
2018-01-31 16:23:01 +01:00
2021-10-14 15:40:18 +02:00
### Duplicated files
2017-07-10 00:23:53 +02:00
Sometimes, for no reason I've been able to track down, drive will
duplicate a file that rclone uploads. Drive unlike all the other
remotes can have duplicated files.
Duplicated files cause problems with the syncing and you will see
messages in the log about duplicates.
Use `rclone dedupe` to fix duplicated files.
Note that this isn't just a problem with rclone, even Google Photos on
Android duplicates files on drive sometimes.
2021-10-14 15:40:18 +02:00
### Rclone appears to be re-copying files it shouldn't
2017-07-10 00:23:53 +02:00
2018-01-31 17:15:30 +01:00
The most likely cause of this is the duplicated file issue above - run
`rclone dedupe` and check your logs for duplicate object or directory
messages.
2017-07-11 00:06:06 +02:00
2019-02-25 21:46:27 +01:00
This can also be caused by a delay/caching on google drive's end when
comparing directory listings. Specifically with team drives used in
combination with --fast-list. Files that were uploaded recently may
not appear on the directory list sent to rclone when using --fast-list.
Waiting a moderate period of time between attempts (estimated to be
approximately 1 hour) and/or not using --fast-list both seem to be
effective in preventing the problem.
2021-10-14 15:40:18 +02:00
## Making your own client_id
2016-08-24 23:06:41 +02:00
When you use rclone with Google drive in its default configuration you
are using rclone's client_id. This is shared between all the rclone
users. There is a global rate limit on the number of queries per
second that each client_id can do set by Google. rclone already has a
high quota and I will continue to make sure it is high enough by
contacting Google.
2018-12-21 15:31:55 +01:00
It is strongly recommended to use your own client ID as the default rclone ID is heavily used. If you have multiple services running, it is recommended to use an API key for each service. The default Google quota is 10 transactions per second so it is recommended to stay under that number as if you use more than that, it will cause rclone to rate limit and make things slower.
2016-08-24 23:06:41 +02:00
Here is how to create your own Google Drive client ID for rclone:
1. Log into the [Google API
Console](https://console.developers.google.com/) with your Google
account. It doesn't matter what Google account you use. (It need not
be the same account as the Google Drive you want to access)
2. Select a project or create a new project.
2017-10-16 04:46:20 +02:00
3. Under "ENABLE APIS AND SERVICES" search for "Drive", and enable the
2019-07-02 11:10:09 +02:00
"Google Drive API".
2016-08-24 23:06:41 +02:00
2017-10-16 04:46:20 +02:00
4. Click "Credentials" in the left-side panel (not "Create
2020-02-01 14:41:18 +01:00
credentials", which opens the wizard), then "Create credentials"
2016-08-24 23:06:41 +02:00
2020-02-01 14:41:18 +01:00
5. If you already configured an "Oauth Consent Screen", then skip
to the next step; if not, click on "CONFIGURE CONSENT SCREEN" button
(near the top right corner of the right panel), then select "External"
and click on "CREATE"; on the next screen, enter an "Application name"
2022-01-31 14:23:00 +01:00
("rclone" is OK); enter "User Support Email" (your own email is OK);
enter "Developer Contact Email" (your own email is OK); then click on "Save" (all other data is optional).
2020-02-01 14:41:18 +01:00
Click again on "Credentials" on the left panel to go back to the
"Credentials" screen.
2022-06-17 17:50:01 +02:00
(PS: if you are a GSuite user, you could also select "Internal" instead
of "External" above, but this will restrict API use to Google Workspace
users in your organisation).
2020-02-01 14:41:18 +01:00
6. Click on the "+ CREATE CREDENTIALS" button at the top of the screen,
then select "OAuth client ID".
2021-10-13 23:31:05 +02:00
7. Choose an application type of "Desktop app" and click "Create". (the default name is fine)
2016-08-24 23:06:41 +02:00
2021-06-10 18:00:52 +02:00
8. It will show you a client ID and client secret. Make a note of these.
2022-06-17 17:50:01 +02:00
(If you selected "External" at Step 5 continue to "Publish App" in the Steps 9 and 10.
If you chose "Internal" you don't need to publish and can skip straight to
Step 11.)
2021-06-10 18:00:52 +02:00
9. Go to "Oauth consent screen" and press "Publish App"
2022-06-17 17:50:01 +02:00
10. Click "OAuth consent screen", then click "PUBLISH APP" button and
2021-05-20 06:56:20 +02:00
confirm, or add your account under "Test users".
2022-06-17 17:50:01 +02:00
11. Provide the noted client ID and client secret to rclone.
2020-02-01 14:41:18 +01:00
Be aware that, due to the "enhanced security" recently introduced by
Google, you are theoretically expected to "submit your app for verification"
and then wait a few weeks(!) for their response; in practice, you can go right
ahead and use the client ID and client secret with rclone, the only issue will
be a very scary confirmation screen shown when you connect via your browser
for rclone to be able to get its token-id (but as this only happens during
the remote configuration, it's not such a big deal).
2016-08-24 23:06:41 +02:00
(Thanks to @balazer on github for these instructions.)
2020-07-16 00:14:39 +02:00
Sometimes, creation of an OAuth consent in Google API Console fails due to an error message
“The request failed because changes to one of the field of the resource is not supported”.
As a convenient workaround, the necessary Google Drive API key can be created on the
[Python Quickstart ](https://developers.google.com/drive/api/v3/quickstart/python ) page.
Just push the Enable the Drive API button to receive the Client ID and Secret.
Note that it will automatically create a new project in the API Console.