Contents
- 1
Google Drive
- 1.1 Configuration
- 1.1.1 Scopes
- 1.1.2 Root folder ID
- 1.1.3 Service Account support
- 1.1.4 Shared drives (team drives)
- 1.1.5 –fast-list
- 1.1.6 Modified time
- 1.1.7 Restricted filename characters
- 1.1.8 Revisions
- 1.1.9 Deleting files
- 1.1.10 Shortcuts
- 1.1.11 Emptying trash
- 1.1.12 Quota information
- 1.1.13 Standard options
- 1.1.14 Advanced options
- 1.1.14.1 –drive-token
- 1.1.14.2 –drive-auth-url
- 1.1.14.3 –drive-token-url
- 1.1.14.4 –drive-service-account-credentials
- 1.1.14.5 –drive-team-drive
- 1.1.14.6 –drive-auth-owner-only
- 1.1.14.7 –drive-use-trash
- 1.1.14.8 –drive-skip-gdocs
- 1.1.14.9 –drive-skip-checksum-gphotos
- 1.1.14.10 –drive-shared-with-me
- 1.1.14.11 –drive-trashed-only
- 1.1.14.12 –drive-starred-only
- 1.1.14.13 –drive-formats
- 1.1.14.14 –drive-export-formats
- 1.1.14.15 –drive-import-formats
- 1.1.14.16 –drive-allow-import-name-change
- 1.1.14.17 –drive-list-chunk
- 1.1.14.18 –drive-impersonate
- 1.1.14.19 –drive-upload-cutoff
- 1.1.14.20 –drive-chunk-size
- 1.1.14.21 –drive-acknowledge-abuse
- 1.1.14.22 –drive-keep-revision-forever
- 1.1.14.23 –drive-size-as-quota
- 1.1.14.24 –drive-v2-download-min-size
- 1.1.14.25 –drive-pacer-min-sleep
- 1.1.14.26 –drive-pacer-burst
- 1.1.14.27 –drive-server-side-across-configs
- 1.1.14.28 –drive-disable-http2
- 1.1.14.29 –drive-stop-on-upload-limit
- 1.1.14.30 –drive-stop-on-download-limit
- 1.1.14.31 –drive-skip-shortcuts
- 1.1.14.32 –drive-encoding
- 1.2 Backend commands
- 1.3 Limitations
- 1.4 Making your own client_id
- 1.1 Configuration
Google Drive
Paths are specified as drive:path
Drive paths may be adenine deep as required, e.g. drive:directory/subdirectory
.
Configuration
The initial frame-up for driveway involves getting a token from Google drive which you need to do in your browser. rclone config
walks you through it .
hera is an example of how to make a distant called remote
. First hunt :
Reading: Google drive
rclone config
This will guide you through an synergistic frame-up process :
No remotes found - make a new one
n) New remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
n/r/c/s/q> n
name> remote
Type of storage to configure.
Choose a number from below, or type in your own value
[snip]
XX / Google Drive
\ "drive"
[snip]
Storage> drive
Google Application Client Id - leave blank normally.
client_id>
Google Application Client Secret - leave blank normally.
client_secret>
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
ID of the root folder - leave blank normally. Fill in to access "Computers" folders. (see docs).
root_folder_id>
Service Account Credentials JSON file path - needed only if you want use SA instead of interactive login.
service_account_file>
Remote config
Use auto config?
* Say Y if not sure
* Say N if you are working on a remote or headless machine or Y didn't work
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
Configure this as a Shared Drive (Team Drive)?
y) Yes
n) No
y/n> n
--------------------
[remote]
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"}
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y
note that rclone runs a webserver on your local machine to collect the token as returned from Google if you use car config modality. This only runs from the here and now it opens your browser to the moment you get back the confirmation code. This is on http://127.0.0.1:53682/
and this it may require you to unblock it temporarily if you are running a host firewall, or use manual mode .
You can then use it like this ,
list directories in peak flat of your drive
rclone lsd remote:
list all the files in your drive
rclone ls remote:
To copy a local directory to a campaign directory called stand-in
rclone copy /home/source remote:backup
Scopes
Rclone allows you to select which telescope you would like for rclone to use. This changes what type of nominal is granted to rclone. The scopes are defined here .
The setting are
drive
This is the default telescope and allows full entree to all files, except for the Application Data Folder ( see below ) .
Choose this one if you are n’t sure .
drive.readonly
This allows read only access to all files. Files may be listed and downloaded but not upload, renamed or deleted .
drive.file
With this oscilloscope 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 utilitarian if you are using rclone to backup data and you want to be certain confidential data on your drive is not visible to rclone .
Files created with this setting are visible in the web interface .
drive.appfolder
This gives rclone its own secret area to store files. Rclone will not be able to see any other files on your drive and you wo n’t be able to see rclone ‘s files from the web interface either .
drive.metadata.readonly
This allows read merely access to file names alone. It does not allow rclone to download or upload data, or rename or edit files or directories .
Root folder ID
You can set the root_folder_id
for rclone. This is the directory ( identified by its Folder ID
) that rclone considers to be the root of your drive .
normally you will leave this lacuna and rclone will determine the correct rout to use itself .
however you can set this to restrict rclone to a specific folder hierarchy or to access data within the “ Computers ” check 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 end segment of the URL when you open the relevant booklet in the tug world wide web interface .
so if the folder you want rclone to use has a URL which looks like https://drive.google.com/drive/folders/1XyfxxxxxxxxxxxxxxxxxxxxxxxxxKHCh
in the browser, then you use 1XyfxxxxxxxxxxxxxxxxxxxxxxxxxKHCh
as the root_folder_id
in the config .
NB folders under the “ Computers ” tab seem to be read only ( drive gives a 500 error ) when using rclone .
There does n’t appear to be an API to discover the booklet IDs of the ” Computers ” tab – please contact us if you know otherwise !
note besides that rclone ca n’t access any data under the “ Backups ” check on the google drive web interface so far .
Service Account support
You can set up rclone with Google Drive in an unattended mode, i.e. not tied to a specific end-user Google report. This is utilitarian when you want to synchronise files onto machines that do n’t have actively logged-in users, for example build machines .
To use a Service Account rather of OAuth2 nominal menstruation, enter the path to your Service Account credentials at the service_account_file
immediate during rclone config
and rclone wo n’t use the browser based 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 alternatively, or set the equivalent environment variable .
Use case – Google Apps/G-suite account and individual Drive
Let ‘s say that you are the administrator of a Google Apps ( old ) or G-suite account. The finish is to store data on an person ‘s Drive report, who IS a member of the domain. We ‘ll call the domain example.com, and the user flickroom.net@gmail.com .
There ‘s a few steps we need to go through to accomplish this :
1. Create a service account for example.com
- To create a service account and obtain its credentials, go to the
Google Developer Console. - 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 - These credentials are what rclone will use for authentication.
If you ever need to remove access, press the “Delete service
account key” button.
2. Allowing API access to example.com Google Drive
- 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.
3. Configure rclone, assuming a new install
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!
y/n> # Auto config, n
4. Verify that it’s working
rclone -v --drive-impersonate flickroom.net@gmail.com lsf gdrive:backup
- The arguments do:
-v
– verbose logging--drive-impersonate flickroom.net@gmail.com
– this is what does
the magic, pretending to be user foo.lsf
– list files in a parsing friendly waygdrive:backup
– use the remote called gdrive, work in
the folder named backup.
note : in case you configured a specific root booklet on gdrive and rclone is ineffective to access the contents of that folder when using --drive-impersonate
, do this alternatively :
- 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:
rclone -v lsf gdrive:backup
If you want to configure the distant 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)?
.
This will fetch the list of Shared Drives from google and allow you to configure which one you want to use. You can besides type in a Shared Drive ID if you prefer .
For exemplar :
Configure this as a Shared Drive (Team Drive)?
y) Yes
n) No
y/n> y
Fetching Shared Drive list...
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"
Enter a Shared Drive ID> 1
--------------------
[remote]
client_id =
client_secret =
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
–fast-list
This outback supports --fast-list
which allows you to use fewer transactions in exchange for more memory. See the rclone department of commerce 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. To list the contents of directories a, boron and c, the following requests will be send by the regular List
officiate :
trashed=false and 'a' in parents
trashed=false and 'b' in parents
trashed=false and 'c' in parents
These can immediately 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 latitude .
In tests, these batch requests were up to 20x faster than the regular method acting. Running the play along instruction against different size folders gives :
rclone lsjson -vv -R --checkers=6 gdrive:folder
humble booklet ( 220 directories, 700 files ) :
- without
--fast-list
: 38s - with
--fast-list
: 10s
boastfully folder ( 10600 directories, 39000 files ) :
- without
--fast-list
: 22:05 min - with
--fast-list
: 58s
Modified time
Google drive stores modification times accurate to 1 ms .
Restricted filename characters
only Invalid UTF-8 bytes will be replaced, as they ca n’t be used in JSON strings .
In contrast to other backends, /
can besides be used in names and .
or ..
are valid names .
Revisions
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.
Deleting files
By default rclone will send all files to the methamphetamine when deleting files. If deleting them permanently is required then use the --drive-use-trash=false
flag, or set the equivalent environment variable .
Shortcuts
In March 2020 Google introduced a new feature in Google Drive called drive shortcuts ( API ). These will ( by September 2020 ) replace the ability for files or folders to be in multiple folders at once .
Shortcuts are files that link to early files on Google Drive reasonably like a symlink in unix, except they point to the underlying file data ( e.g. the inode in unix terms ) so they do n’t break if the beginning is renamed or moved about .
Be default option 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.
- When server-side moving (renaming) the shortcut is renamed, not the destination file.
- When server-side copying the shortcut is copied, not the contents of the shortcut.
- 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
- 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.
- When deleting with
rclone rmdir
orrclone purge
the shortcut is deleted not the linked folder. - NB When deleting with
rclone remove
orrclone mount
the contents of the linked folder will be deleted.
The rclone backend command can be used to create shortcuts .
Shortcuts can be wholly ignored with the --drive-skip-shortcuts
flag or the correspond skip_shortcuts
shape set .
Emptying trash
If you wish to empty your methamphetamine you can use the rclone cleanup remote:
command which will permanently delete all your trash files. This command does not take any path arguments .
note that Google Drive takes some time ( minutes to days ) to empty the trash even though the command returns within a few seconds. No end product is echoed, so there will be no ratification even using -v or -vv .
Quota information
To view your current quota you can use the rclone about remote:
command which will display your use specify ( quota ), the use in Google Drive, the size of all files in the Trash and the space used by early Google services such as Gmail. This command does not take any path arguments .
Import/Export of google documents
Google documents can be exported from and uploaded to Google Drive .
When rclone downloads a Google department of commerce it chooses a format to download depending upon the --drive-export-formats
setting. By nonpayment the export formats are docx,xlsx,pptx,svg
which are a sensible default for an editable document .
When choosing a format, rclone runs down the list provided in order and chooses the first file format the doctor can be exported as from the tilt. If the charge ca n’t be exported to a format on the formats list, then rclone will choose a format from the nonpayment list .
If you prefer an archive copy then you might use --drive-export-formats pdf
, or if you prefer openoffice/libreoffice formats you might use --drive-export-formats ods,odt,odp
.
note that rclone adds the extension to the google doctor, sol if it is called My Spreadsheet
on google department of commerce, it will be exported as My Spreadsheet.xlsx
or My Spreadsheet.pdf
etc .
When importing files into Google Drive, rclone will convert all 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 serve .
The conversion must result in a file with the same reference when the --drive-export-formats
rules are applied to the upload document .
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 limit can be disabled by specifying --drive-allow-import-name-change
. When using this pin, rclone can convert multiple files types resulting in the same document type at once, e.g. with --drive-import-formats docx,odt,txt
, all files having these extension would result in a document represented as a docx charge. This brings the extra risk of overwriting a document, if multiple files have the like stem. many rclone operations will not handle this list switch in any room. They assume an equal list when replicate files and might copy the file again or delete them when the name changes .
here are the possible export extensions with their equate mimic types. Most of these can besides be used for importing, but there more that are not listed here. Some of these extra ones might merely be available when the function system provides the compensate MIME type entries .
This tilt can be changed by Google Drive at any time and might not represent the presently available conversions .
Extension | Mime Type | Description |
---|---|---|
csv | text/csv | Standard CSV format for Spreadsheets |
docx | application/vnd.openxmlformats-officedocument.wordprocessingml.document | Microsoft Office Document |
epub | application/epub+zip | E-book format |
html | text/html | An HTML Document |
jpg | image/jpeg | A JPEG Image File |
json | application/vnd.google-apps.script+json | JSON Text Format |
odp | application/vnd.oasis.opendocument.presentation | Openoffice Presentation |
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 |
application/pdf | Adobe PDF Format | |
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 |
tsv | text/tab-separated-values | Standard TSV format for spreadsheets |
txt | text/plain | Plain Text |
xlsx | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | Microsoft Office Spreadsheet |
zip | application/zip | A ZIP file of HTML, Images CSS |
Google documents can besides be exported as link files. These files will open a browser window for the Google Docs web site of that document when opened. The connection 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 |
Standard options
here are the criterion options specific to drive ( Google Drive ) .
–drive-client-id
Google Application Client Id Setting your own is recommended. See hypertext transfer protocol : //flickroom.net/drive/ # making-your-own-client-id for how to create your own. If you leave this space, it will use an inner key which is gloomy performance .
- Config: client_id
- Env Var: RCLONE_DRIVE_CLIENT_ID
- Type: string
- Default: “”
–drive-client-secret
OAuth Client Secret .
Leave blank normally .
- Config: client_secret
- Env Var: RCLONE_DRIVE_CLIENT_SECRET
- Type: string
- Default: “”
–drive-scope
setting that rclone should use when requesting entree from drive .
- Config: scope
- Env Var: RCLONE_DRIVE_SCOPE
- Type: string
- Default: “”
- 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”
–drive-root-folder-id
ID of the root booklet. Leave blank normally .
Fill in to entree “ Computers ” folders ( see doctor ), or for rclone to use a not settle folder as its starting item .
- Config: root_folder_id
- Env Var: RCLONE_DRIVE_ROOT_FOLDER_ID
- Type: string
- Default: “”
–drive-service-account-file
Service Account Credentials JSON file way .
Leave blank normally. Needed merely if you want use SA rather of synergistic login .
Leading ~
will be expanded in the file name as will environment variables such as ${RCLONE_CONFIG_DIR}
.
- Config: service_account_file
- Env Var: RCLONE_DRIVE_SERVICE_ACCOUNT_FILE
- Type: string
- Default: “”
–drive-alternate-export
Deprecated : no longer needed .
- Config: alternate_export
- Env Var: RCLONE_DRIVE_ALTERNATE_EXPORT
- Type: bool
- Default: false
Advanced options
here are the advance options specific to drive ( Google Drive ) .
–drive-token
OAuth Access Token as a JSON spot .
- Config: token
- Env Var: RCLONE_DRIVE_TOKEN
- Type: string
- Default: “”
–drive-auth-url
Auth waiter URL .
Leave space to use the provider defaults .
- Config: auth_url
- Env Var: RCLONE_DRIVE_AUTH_URL
- Type: string
- Default: “”
–drive-token-url
Token server url .
Leave lacuna to use the provider defaults .
- Config: token_url
- Env Var: RCLONE_DRIVE_TOKEN_URL
- Type: string
- Default: “”
–drive-service-account-credentials
Service Account Credentials JSON blob .
Leave blank normally. Needed only if you want use SA alternatively of interactional login .
- Config: service_account_credentials
- Env Var: RCLONE_DRIVE_SERVICE_ACCOUNT_CREDENTIALS
- Type: string
- Default: “”
–drive-team-drive
ID of the Shared Drive ( Team Drive ) .
- Config: team_drive
- Env Var: RCLONE_DRIVE_TEAM_DRIVE
- Type: string
- Default: “”
–drive-auth-owner-only
lone consider files owned by the authenticated user .
- Config: auth_owner_only
- Env Var: RCLONE_DRIVE_AUTH_OWNER_ONLY
- Type: bool
- Default: false
–drive-use-trash
Send files to the trash rather of deleting permanently .
Defaults to true, namely sending files to the methamphetamine. Use --drive-use-trash=false
to delete files permanently alternatively .
- Config: use_trash
- Env Var: RCLONE_DRIVE_USE_TRASH
- Type: bool
- Default: true
–drive-skip-gdocs
Skip google documents in all listings .
If given, gdocs practically become invisible to rclone .
- Config: skip_gdocs
- Env Var: RCLONE_DRIVE_SKIP_GDOCS
- Type: bool
- Default: false
–drive-skip-checksum-gphotos
Skip MD5 checksum on Google photograph and video lone .
Use this if you get checksum errors when transferring Google photograph or video .
Setting this flag will cause Google photos and videos to return a blank MD5 checksum .
Google photos are identified by being in the “ photograph ” space .
Corrupted checksums are caused by Google modifying the image/video but not updating the checksum .
- Config: skip_checksum_gphotos
- Env Var: RCLONE_DRIVE_SKIP_CHECKSUM_GPHOTOS
- Type: bool
- Default: false
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 ) .
This works both with the “ tilt ” ( lsd, lsl, etc. ) and the “ copy ” commands ( copy, synchronize, etc. ), and with all other commands excessively .
- Config: shared_with_me
- Env Var: RCLONE_DRIVE_SHARED_WITH_ME
- Type: bool
- Default: false
–drive-trashed-only
only prove files that are in the pan .
This will show pan files in their original directory structure .
- Config: trashed_only
- Env Var: RCLONE_DRIVE_TRASHED_ONLY
- Type: bool
- Default: false
–drive-starred-only
only show files that are starred .
- Config: starred_only
- Env Var: RCLONE_DRIVE_STARRED_ONLY
- Type: bool
- Default: false
–drive-formats
Deprecated : See export_formats .
- Config: formats
- Env Var: RCLONE_DRIVE_FORMATS
- Type: string
- Default: “”
–drive-export-formats
Comma separated list of choose formats for downloading Google department of commerce .
- Config: export_formats
- Env Var: RCLONE_DRIVE_EXPORT_FORMATS
- Type: string
- Default: “docx,xlsx,pptx,svg”
–drive-import-formats
Comma separated list of prefer formats for uploading Google department of commerce .
- Config: import_formats
- Env Var: RCLONE_DRIVE_IMPORT_FORMATS
- Type: string
- Default: “”
–drive-allow-import-name-change
Allow the filetype to change when uploading Google department of commerce.
E.g. file.doc to file.docx. This will confuse synchronize and reupload every time .
- Config: allow_import_name_change
- Env Var: RCLONE_DRIVE_ALLOW_IMPORT_NAME_CHANGE
- Type: bool
- Default: false
Use file created date alternatively of modify date .
useful when downloading data and you want the creation date used in space of the last modify date .
WARNING : This ease up may have some unexpected consequences .
When uploading to your force all files will be overwritten unless they have n’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 photograph capture date as recorded by google photos. You will first need to check the “ Create a Google Photos booklet ” option in your google drive settings. You can then copy or move the photograph locally and use the date the double was taken ( created ) set as the modification date .
- Config: use_created_date
- Env Var: RCLONE_DRIVE_USE_CREATED_DATE
- Type: bool
- Default: false
Use date file was shared rather of change date .
note that, as with “ — drive-use-created-date ”, this pin may have unexpected consequences when uploading/downloading files .
If both this ease up and “ — drive-use-created-date ” are set, the create date is used .
- Config: use_shared_date
- Env Var: RCLONE_DRIVE_USE_SHARED_DATE
- Type: bool
- Default: false
–drive-list-chunk
size of listing chunk 100-1000, 0 to disable .
- Config: list_chunk
- Env Var: RCLONE_DRIVE_LIST_CHUNK
- Type: int
- Default: 1000
–drive-impersonate
Impersonate this user when using a serve account .
- Config: impersonate
- Env Var: RCLONE_DRIVE_IMPERSONATE
- Type: string
- Default: “”
–drive-upload-cutoff
Cutoff for switching to chunked upload .
- Config: upload_cutoff
- Env Var: RCLONE_DRIVE_UPLOAD_CUTOFF
- Type: SizeSuffix
- Default: 8Mi
–drive-chunk-size
Upload chunk size .
Must a power of 2 > = 256k .
Making this larger will improve performance, but note that each chunk is buffered in memory one per transfer .
Reducing this will reduce memory use but decrease operation .
- Config: chunk_size
- Env Var: RCLONE_DRIVE_CHUNK_SIZE
- Type: SizeSuffix
- Default: 8Mi
–drive-acknowledge-abuse
adjust 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 can not be downloaded ” with the mistake code ” cannotDownloadAbusiveFile ” then supply this flag to rclone to indicate you acknowledge the risks of downloading the file and rclone will download it anyhow .
- Config: acknowledge_abuse
- Env Var: RCLONE_DRIVE_ACKNOWLEDGE_ABUSE
- Type: bool
- Default: false
–drive-keep-revision-forever
Keep newly capitulum revision of each file constantly .
- Config: keep_revision_forever
- Env Var: RCLONE_DRIVE_KEEP_REVISION_FOREVER
- Type: bool
- Default: false
–drive-size-as-quota
Show sizes as storage quota use, not actual size .
Show the size of a file as the storage quota used. This is the stream interpretation plus any older versions that have been set to keep everlastingly .
WARNING : This ease up may have some unexpected consequences .
It is not recommended to set this sag in your config – the recommend use is using the flag form — drive-size-as-quota when doing rclone ls/lsl/lsf/lsjson/etc only .
If you do use this masthead for syncing ( not recommended ) then you will need to use — ignore size besides .
- Config: size_as_quota
- Env Var: RCLONE_DRIVE_SIZE_AS_QUOTA
- Type: bool
- Default: false
–drive-v2-download-min-size
If Object ‘s are greater, use driveway v2 API to download .
- Config: v2_download_min_size
- Env Var: RCLONE_DRIVE_V2_DOWNLOAD_MIN_SIZE
- Type: SizeSuffix
- Default: off
–drive-pacer-min-sleep
minimal time to sleep between API calls .
- 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 .
- Config: pacer_burst
- Env Var: RCLONE_DRIVE_PACER_BURST
- Type: int
- Default: 100
–drive-server-side-across-configs
give up server-side operations ( e.g. copy ) to work across different campaign configs .
This can be useful if you wish to do a server-side replicate between two different Google drives. note that this is n’t enabled by default because it is n’t easy to tell if it will work between any two configurations .
- Config: server_side_across_configs
- Env Var: RCLONE_DRIVE_SERVER_SIDE_ACROSS_CONFIGS
- Type: bool
- Default: false
–drive-disable-http2
disable drive using http2 .
There is presently an unsolved issue with the google drive backend and HTTP/2. HTTP/2 is therefore disable by default option for the drive backend but can be re-enabled here. When the issue is solved this iris will be removed .
See : hypertext transfer protocol : //github.com/rclone/rclone/issues/3631
- Config: disable_http2
- Env Var: RCLONE_DRIVE_DISABLE_HTTP2
- Type: bool
- Default: true
–drive-stop-on-upload-limit
Make upload limit errors be fatal .
At the time of writing it is merely possible to upload 750 GiB of data to Google Drive a day ( this is an undocumented restrict ). When this specify is reached Google Drive produces a slightly unlike erroneousness message. When this flag is set it causes these errors to be fatal. These will stop the in-progress synchronize .
note that this signal detection is relying on error message strings which Google do n’t document so it may break in the future .
See : hypertext transfer protocol : //github.com/rclone/rclone/issues/3857
- Config: stop_on_upload_limit
- Env Var: RCLONE_DRIVE_STOP_ON_UPLOAD_LIMIT
- Type: bool
- Default: false
–drive-stop-on-download-limit
Make download limit errors be black .
At the clock of writing it is entirely possible to download 10 TiB of data from Google Drive a day ( this is an undocumented limit ). When this terminus ad quem is reached Google Drive produces a slightly different erroneousness message. When this flag is set it causes these errors to be fatal. These will stop the in-progress synchronize .
note that this detection is relying on erroneousness message strings which Google do n’t document so it may break in the future .
- Config: stop_on_download_limit
- Env Var: RCLONE_DRIVE_STOP_ON_DOWNLOAD_LIMIT
- Type: bool
- Default: false
–drive-skip-shortcuts
If set hop shortcut files .
normally rclone dereferences shortcut files making them appear as if they are the original file ( see the shortcuts section ). If this flag is set then rclone will ignore shortcut files wholly .
- Config: skip_shortcuts
- Env Var: RCLONE_DRIVE_SKIP_SHORTCUTS
- Type: bool
- Default: false
–drive-encoding
This sets the encoding for the backend .
See the encoding department in the overview for more information .
- Config: encoding
- Env Var: RCLONE_DRIVE_ENCODING
- Type: MultiEncoder
- Default: InvalidUtf8
Backend commands
hera are the commands specific to the drive backend .
Run them with
rclone backend COMMAND remote:
The help below will explain what arguments each command takes .
See the “ rclone backend ” command for more information on how to pass options and arguments .
These can be run on a running backend using the rc control backend/command .
get
Get command for fetching the drive config parameters
rclone backend get remote: [options] [+]
This is a pay back instruction which will be used to fetch the diverse drive config parameters
custom 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
set
Set command for updating the drive config parameters
rclone backend set remote: [options] [+]
This is a set dominate which will be used to update the versatile force config parameters
custom 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
shortcut
Create shortcuts from files or directories
rclone backend shortcut remote: [options] [+]
This control 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 gear exercise 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 case this creates a shortcut from the “ source_item ” relative to “ drive : ” to the “ destination_shortcut ” relative to ” drive2 : ”. This may fail with a license mistake if the user authenticated with “ drive2 : ” ca n’t read files from “ drive : ” .
Options :
- “target”: optional target remote for the shortcut destination
drives
List the Shared Drives available to this bill
rclone backend drives remote: [options] [+]
This control lists the Shared Drives ( Team Drives ) available to this account .
use :
rclone backend [-o config] drives drive:
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"
}
]
With the -o config argument it will end product the list in a format suitable for adding to a config file to make aliases for all the drives found .
[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=:
Adding this to the rclone config file will cause those team drives to be accessible with the aliases shown. This may require manual edit of the names .
untrash
Untrash files and directories
rclone backend untrash remote: [options] [+]
This dominate 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 .
solution :
{
"Untrashed": 17,
"Errors": 0
}
copyid
transcript files by ID
rclone backend copyid remote: [options] [+]
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 way which will be passed internally to rclone copyto ). The ID and way pairs can be repeated .
The path should end with a / to indicate copy the file as named to this directory. If it does n’t end with a / then the last path component will be used as the file appoint .
If the address is a tug backend then server-side copy will be attempted if potential .
Use the -i flag to see what would be copied before copying .
Limitations
Drive has quite a batch of rate limit. This causes rclone to be limited to transferring about 2 files per second only. individual files may be transferred much faster at 100s of MiB/s but lots of little files can take a long clock .
Server side copies are besides subject to a offprint pace restrict. If you see user rate limit exceeded errors, wait at least 24 hours and rehear. You can disable server-side copies with --disable copy
to download and upload the files if you prefer .
Limitations of Google Docs
Google doctor will appear as size -1 in rclone ls
and as size 0 in anything which uses the VFS layer, e.g. rclone mount
, rclone serve
.
This is because rclone ca n’t find out the size of the Google doctor without downloading them .
Google department of commerce will transfer correctly with rclone sync
, rclone copy
etc as rclone knows to ignore the size when doing the transportation .
however an unfortunate consequence of this is that you may not be able to download Google department of commerce using rclone mount
. If it does n’t work you will get a 0 sized file. If you try again the doctor may gain its discipline size and be downloadable. Whether it will work on not depends on the lotion accessing the mount and the OS you are running – experiment to find out if it does work for you !
Duplicated files
sometimes, for no reason I ‘ve been able to track down, campaign will duplicate a file that rclone uploads. Drive unlike all the other remotes can have duplicated files .
Duplicated files cause problems with the synchronize and you will see messages in the logarithm about duplicates .
Use rclone dedupe
to fix duplicate files .
note that this is n’t just a trouble with rclone, flush Google Photos on Android duplicates files on drive sometimes .
Rclone appears to be re-copying files it shouldn’t
The most likely causal agent of this is the double file issue above – run rclone dedupe
and check your logs for duplicate object or directory messages .
This can besides be caused by a delay/caching on google campaign ‘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 tone down time 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 .
Making your own client_id
When you use rclone with Google drive in its default shape you are using rclone ‘s client_id. This is shared between all the rclone users. There is a ball-shaped 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 certain it is gamey adequate by contacting Google .
It is powerfully 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 irregular so it is recommended to stay under that count as if you use more than that, it will cause rclone to rate limit and make things slower .
hera is how to create your own Google Drive customer ID for rclone :
- Log into the Google API Console with your Google account. It does n’t matter what Google account you use. ( It need not be the same account as the Google Drive you want to access )
- Select a plan or create a new project .
- Under “ ENABLE APIS AND SERVICES ” search for “ Drive ”, and enable the ” Google Drive API ” .
- Click “ Credentials ” in the left-side panel ( not “ Create credentials ”, which opens the ace ), then “ Create credentials ”
- If you already configured an “ Oauth Consent Screen ”, then skip to the adjacent 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 ” ( “ rclone ” is OK ) then click on “ Save ” ( all other data is optional ). Click again on “ Credentials ” on the left field panel to go back to the ” Credentials ” screen .
( phosphorus : if you are a GSuite exploiter, you could besides select “ Internal ” rather of “ External ” above, but this has not been tested/documented sol far ) .
- Click on the “ + produce CREDENTIALS ” button at the exceed of the screen, then select “ OAuth client ID ” .
- Choose an lotion type of “ Desktop app ” and click “ Create ”. ( the default list is fine )
- It will show you a node ID and customer secret. Make a note of these .
- Go to “ Oauth consent screen ” and press “ print App ”
- Provide the note customer ID and customer unavowed to rclone .
-
Click “ OAuth consent screen ”, then click “ PUBLISH APP ” clitoris and confirm, or add your account under “ Test users ”.
Read more: WITS: Google Documents
Be aware that, due to the “ enhance security ” recently introduced by Google, you are theoretically expected to “ submit your app for verification ” and then wait a few weeks ( ! ) for their reply ; in exercise, you can go right ahead and use the node ID and node secret with rclone, the lone issue will be a very chilling 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 distant shape, it ‘s not such a big share ) .
( Thanks to @ balazer on github for these instructions. )
sometimes, initiation of an OAuth accept 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 necessity Google Drive API key can be created on the Python Quickstart foliate. 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 .