github.com/artpar/rclone@v1.67.3/docs/content/drive.md (about)

     1  ---
     2  title: "Google drive"
     3  description: "Rclone docs for Google drive"
     4  versionIntroduced: "v0.91"
     5  ---
     6  
     7  # {{< icon "fab fa-google" >}} Google Drive
     8  
     9  Paths are specified as `drive:path`
    10  
    11  Drive paths may be as deep as required, e.g. `drive:directory/subdirectory`.
    12  
    13  ## Configuration
    14  
    15  The initial setup for drive involves getting a token from Google drive
    16  which you need to do in your browser.  `rclone config` walks you
    17  through it.
    18  
    19  Here is an example of how to make a remote called `remote`.  First run:
    20  
    21       rclone config
    22  
    23  This will guide you through an interactive setup process:
    24  
    25  ```
    26  No remotes found, make a new one?
    27  n) New remote
    28  r) Rename remote
    29  c) Copy remote
    30  s) Set configuration password
    31  q) Quit config
    32  n/r/c/s/q> n
    33  name> remote
    34  Type of storage to configure.
    35  Choose a number from below, or type in your own value
    36  [snip]
    37  XX / Google Drive
    38     \ "drive"
    39  [snip]
    40  Storage> drive
    41  Google Application Client Id - leave blank normally.
    42  client_id>
    43  Google Application Client Secret - leave blank normally.
    44  client_secret>
    45  Scope that rclone should use when requesting access from drive.
    46  Choose a number from below, or type in your own value
    47   1 / Full access all files, excluding Application Data Folder.
    48     \ "drive"
    49   2 / Read-only access to file metadata and file contents.
    50     \ "drive.readonly"
    51     / Access to files created by rclone only.
    52   3 | These are visible in the drive website.
    53     | File authorization is revoked when the user deauthorizes the app.
    54     \ "drive.file"
    55     / Allows read and write access to the Application Data folder.
    56   4 | This is not visible in the drive website.
    57     \ "drive.appfolder"
    58     / Allows read-only access to file metadata but
    59   5 | does not allow any access to read or download file content.
    60     \ "drive.metadata.readonly"
    61  scope> 1
    62  Service Account Credentials JSON file path - needed only if you want use SA instead of interactive login.
    63  service_account_file>
    64  Remote config
    65  Use web browser to automatically authenticate rclone with remote?
    66   * Say Y if the machine running rclone has a web browser you can use
    67   * Say N if running rclone on a (remote) machine without web browser access
    68  If not sure try Y. If Y failed, try N.
    69  y) Yes
    70  n) No
    71  y/n> y
    72  If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth
    73  Log in and authorize rclone for access
    74  Waiting for code...
    75  Got code
    76  Configure this as a Shared Drive (Team Drive)?
    77  y) Yes
    78  n) No
    79  y/n> n
    80  --------------------
    81  [remote]
    82  client_id = 
    83  client_secret = 
    84  scope = drive
    85  root_folder_id = 
    86  service_account_file =
    87  token = {"access_token":"XXX","token_type":"Bearer","refresh_token":"XXX","expiry":"2014-03-16T13:57:58.955387075Z"}
    88  --------------------
    89  y) Yes this is OK
    90  e) Edit this remote
    91  d) Delete this remote
    92  y/e/d> y
    93  ```
    94  
    95  See the [remote setup docs](/remote_setup/) for how to set it up on a
    96  machine with no Internet browser available.
    97  
    98  Note that rclone runs a webserver on your local machine to collect the
    99  token as returned from Google if using web browser to automatically 
   100  authenticate. This only
   101  runs from the moment it opens your browser to the moment you get back
   102  the verification code.  This is on `http://127.0.0.1:53682/` and it
   103  may require you to unblock it temporarily if you are running a host
   104  firewall, or use manual mode.
   105  
   106  You can then use it like this,
   107  
   108  List directories in top level of your drive
   109  
   110      rclone lsd remote:
   111  
   112  List all the files in your drive
   113  
   114      rclone ls remote:
   115  
   116  To copy a local directory to a drive directory called backup
   117  
   118      rclone copy /home/source remote:backup
   119  
   120  ### Scopes
   121  
   122  Rclone allows you to select which scope you would like for rclone to
   123  use.  This changes what type of token is granted to rclone.  [The
   124  scopes are defined
   125  here](https://developers.google.com/drive/v3/web/about-auth).
   126  
   127  A comma-separated list is allowed e.g. `drive.readonly,drive.file`.
   128  
   129  The scope are
   130  
   131  #### drive
   132  
   133  This is the default scope and allows full access to all files, except
   134  for the Application Data Folder (see below).
   135  
   136  Choose this one if you aren't sure.
   137  
   138  #### drive.readonly
   139  
   140  This allows read only access to all files.  Files may be listed and
   141  downloaded but not uploaded, renamed or deleted.
   142  
   143  #### drive.file
   144  
   145  With this scope rclone can read/view/modify only those files and
   146  folders it creates.
   147  
   148  So if you uploaded files to drive via the web interface (or any other
   149  means) they will not be visible to rclone.
   150  
   151  This can be useful if you are using rclone to backup data and you want
   152  to be sure confidential data on your drive is not visible to rclone.
   153  
   154  Files created with this scope are visible in the web interface.
   155  
   156  #### drive.appfolder
   157  
   158  This gives rclone its own private area to store files.  Rclone will
   159  not be able to see any other files on your drive and you won't be able
   160  to see rclone's files from the web interface either.
   161  
   162  #### drive.metadata.readonly
   163  
   164  This allows read only access to file names only.  It does not allow
   165  rclone to download or upload data, or rename or delete files or
   166  directories.
   167  
   168  ### Root folder ID
   169  
   170  This option has been moved to the advanced section. You can set the `root_folder_id` for rclone.  This is the directory
   171  (identified by its `Folder ID`) that rclone considers to be the root
   172  of your drive.
   173  
   174  Normally you will leave this blank and rclone will determine the
   175  correct root to use itself.
   176  
   177  However you can set this to restrict rclone to a specific folder
   178  hierarchy or to access data within the "Computers" tab on the drive
   179  web interface (where files from Google's Backup and Sync desktop
   180  program go).
   181  
   182  In order to do this you will have to find the `Folder ID` of the
   183  directory you wish rclone to display.  This will be the last segment
   184  of the URL when you open the relevant folder in the drive web
   185  interface.
   186  
   187  So if the folder you want rclone to use has a URL which looks like
   188  `https://drive.google.com/drive/folders/1XyfxxxxxxxxxxxxxxxxxxxxxxxxxKHCh`
   189  in the browser, then you use `1XyfxxxxxxxxxxxxxxxxxxxxxxxxxKHCh` as
   190  the `root_folder_id` in the config.
   191  
   192  **NB** folders under the "Computers" tab seem to be read only (drive
   193  gives a 500 error) when using rclone.
   194  
   195  There doesn't appear to be an API to discover the folder IDs of the
   196  "Computers" tab - please contact us if you know otherwise!
   197  
   198  Note also that rclone can't access any data under the "Backups" tab on
   199  the google drive web interface yet.
   200  
   201  ### Service Account support
   202  
   203  You can set up rclone with Google Drive in an unattended mode,
   204  i.e. not tied to a specific end-user Google account. This is useful
   205  when you want to synchronise files onto machines that don't have
   206  actively logged-in users, for example build machines.
   207  
   208  To use a Service Account instead of OAuth2 token flow, enter the path
   209  to your Service Account credentials at the `service_account_file`
   210  prompt during `rclone config` and rclone won't use the browser based
   211  authentication flow. If you'd rather stuff the contents of the
   212  credentials file into the rclone config file, you can set
   213  `service_account_credentials` with the actual contents of the file
   214  instead, or set the equivalent environment variable.
   215  
   216  #### Use case - Google Apps/G-suite account and individual Drive
   217  
   218  Let's say that you are the administrator of a Google Apps (old) or
   219  G-suite account.
   220  The goal is to store data on an individual's Drive account, who IS
   221  a member of the domain.
   222  We'll call the domain **example.com**, and the user
   223  **foo@example.com**.
   224  
   225  There's a few steps we need to go through to accomplish this:
   226  
   227  ##### 1. Create a service account for example.com
   228    - To create a service account and obtain its credentials, go to the
   229  [Google Developer Console](https://console.developers.google.com).
   230    - You must have a project - create one if you don't.
   231    - Then go to "IAM & admin" -> "Service Accounts".
   232    - Use the "Create Service Account" button. Fill in "Service account name"
   233  and "Service account ID" with something that identifies your client.
   234    - Select "Create And Continue". Step 2 and 3 are optional.
   235    - These credentials are what rclone will use for authentication.
   236  If you ever need to remove access, press the "Delete service
   237  account key" button.
   238  
   239  ##### 2. Allowing API access to example.com Google Drive
   240    - Go to example.com's admin console
   241    - Go into "Security" (or use the search bar)
   242    - Select "Show more" and then "Advanced settings"
   243    - Select "Manage API client access" in the "Authentication" section
   244    - In the "Client Name" field enter the service account's
   245  "Client ID" - this can be found in the Developer Console under
   246  "IAM & Admin" -> "Service Accounts", then "View Client ID" for
   247  the newly created service account.
   248  It is a ~21 character numerical string.
   249    - In the next field, "One or More API Scopes", enter
   250  `https://www.googleapis.com/auth/drive`
   251  to grant access to Google Drive specifically.
   252  
   253  ##### 3. Configure rclone, assuming a new install
   254  
   255  ```
   256  rclone config
   257  
   258  n/s/q> n         # New
   259  name>gdrive      # Gdrive is an example name
   260  Storage>         # Select the number shown for Google Drive
   261  client_id>       # Can be left blank
   262  client_secret>   # Can be left blank
   263  scope>           # Select your scope, 1 for example
   264  root_folder_id>  # Can be left blank
   265  service_account_file> /home/foo/myJSONfile.json # This is where the JSON file goes!
   266  y/n>             # Auto config, n
   267  
   268  ```
   269  
   270  ##### 4. Verify that it's working
   271    - `rclone -v --drive-impersonate foo@example.com lsf gdrive:backup`
   272    - The arguments do:
   273      - `-v` - verbose logging
   274      - `--drive-impersonate foo@example.com` - this is what does
   275  the magic, pretending to be user foo.
   276      - `lsf` - list files in a parsing friendly way
   277      - `gdrive:backup` - use the remote called gdrive, work in
   278  the folder named backup.
   279  
   280  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:
   281    - in the gdrive web interface, share your root folder with the user/email of the new Service Account you created/selected at step #1
   282    - use rclone without specifying the `--drive-impersonate` option, like this:
   283          `rclone -v lsf gdrive:backup`
   284  
   285  
   286  ### Shared drives (team drives)
   287  
   288  If you want to configure the remote to point to a Google Shared Drive
   289  (previously known as Team Drives) then answer `y` to the question
   290  `Configure this as a Shared Drive (Team Drive)?`.
   291  
   292  This will fetch the list of Shared Drives from google and allow you to
   293  configure which one you want to use. You can also type in a Shared
   294  Drive ID if you prefer.
   295  
   296  For example:
   297  
   298  ```
   299  Configure this as a Shared Drive (Team Drive)?
   300  y) Yes
   301  n) No
   302  y/n> y
   303  Fetching Shared Drive list...
   304  Choose a number from below, or type in your own value
   305   1 / Rclone Test
   306     \ "xxxxxxxxxxxxxxxxxxxx"
   307   2 / Rclone Test 2
   308     \ "yyyyyyyyyyyyyyyyyyyy"
   309   3 / Rclone Test 3
   310     \ "zzzzzzzzzzzzzzzzzzzz"
   311  Enter a Shared Drive ID> 1
   312  --------------------
   313  [remote]
   314  client_id =
   315  client_secret =
   316  token = {"AccessToken":"xxxx.x.xxxxx_xxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","RefreshToken":"1/xxxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxx","Expiry":"2014-03-16T13:57:58.955387075Z","Extra":null}
   317  team_drive = xxxxxxxxxxxxxxxxxxxx
   318  --------------------
   319  y) Yes this is OK
   320  e) Edit this remote
   321  d) Delete this remote
   322  y/e/d> y
   323  ```
   324  
   325  ### --fast-list
   326  
   327  This remote supports `--fast-list` which allows you to use fewer
   328  transactions in exchange for more memory. See the [rclone
   329  docs](/docs/#fast-list) for more details.
   330  
   331  It does this by combining multiple `list` calls into a single API request.
   332  
   333  This works by combining many `'%s' in parents` filters into one expression.
   334  To list the contents of directories a, b and c, the following requests will be send by the regular `List` function:
   335  ```
   336  trashed=false and 'a' in parents
   337  trashed=false and 'b' in parents
   338  trashed=false and 'c' in parents
   339  ```
   340  These can now be combined into a single request:
   341  ```
   342  trashed=false and ('a' in parents or 'b' in parents or 'c' in parents)
   343  ```
   344  
   345  The implementation of `ListR` will put up to 50 `parents` filters into one request.
   346  It will  use the `--checkers` value to specify the number of requests to run in parallel.
   347  
   348  In tests, these batch requests were up to 20x faster than the regular method.
   349  Running the following command against different sized folders gives:
   350  ```
   351  rclone lsjson -vv -R --checkers=6 gdrive:folder
   352  ```
   353  
   354  small folder (220 directories, 700 files):
   355  
   356  - without `--fast-list`: 38s
   357  - with `--fast-list`: 10s
   358  
   359  large folder (10600 directories, 39000 files):
   360  
   361  - without `--fast-list`: 22:05 min
   362  - with `--fast-list`: 58s
   363  
   364  ### Modification times and hashes
   365  
   366  Google drive stores modification times accurate to 1 ms.
   367  
   368  Hash algorithms MD5, SHA1 and SHA256 are supported. Note, however,
   369  that a small fraction of files uploaded may not have SHA1 or SHA256
   370  hashes especially if they were uploaded before 2018.
   371  
   372  ### Restricted filename characters
   373  
   374  Only Invalid UTF-8 bytes will be [replaced](/overview/#invalid-utf8),
   375  as they can't be used in JSON strings.
   376  
   377  In contrast to other backends, `/` can also be used in names and `.`
   378  or `..` are valid names.
   379  
   380  ### Revisions
   381  
   382  Google drive stores revisions of files.  When you upload a change to
   383  an existing file to google drive using rclone it will create a new
   384  revision of that file.
   385  
   386  Revisions follow the standard google policy which at time of writing
   387  was
   388  
   389    * They are deleted after 30 days or 100 revisions (whatever comes first).
   390    * They do not count towards a user storage quota.
   391  
   392  ### Deleting files
   393  
   394  By default rclone will send all files to the trash when deleting
   395  files.  If deleting them permanently is required then use the
   396  `--drive-use-trash=false` flag, or set the equivalent environment
   397  variable.
   398  
   399  ### Shortcuts
   400  
   401  In March 2020 Google introduced a new feature in Google Drive called
   402  [drive shortcuts](https://support.google.com/drive/answer/9700156)
   403  ([API](https://developers.google.com/drive/api/v3/shortcuts)). These
   404  will (by September 2020) [replace the ability for files or folders to
   405  be in multiple folders at once](https://cloud.google.com/blog/products/g-suite/simplifying-google-drives-folder-structure-and-sharing-models).
   406  
   407  Shortcuts are files that link to other files on Google Drive somewhat
   408  like a symlink in unix, except they point to the underlying file data
   409  (e.g. the inode in unix terms) so they don't break if the source is
   410  renamed or moved about.
   411  
   412  By default rclone treats these as follows.
   413  
   414  For shortcuts pointing to files:
   415  
   416  - When listing a file shortcut appears as the destination file.
   417  - When downloading the contents of the destination file is downloaded.
   418  - When updating shortcut file with a non shortcut file, the shortcut is removed then a new file is uploaded in place of the shortcut.
   419  - When server-side moving (renaming) the shortcut is renamed, not the destination file.
   420  - 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).
   421  - When deleting the shortcut is deleted not the linked file.
   422  - When setting the modification time, the modification time of the linked file will be set.
   423  
   424  For shortcuts pointing to folders:
   425  
   426  - When listing the shortcut appears as a folder and that folder will contain the contents of the linked folder appear (including any sub folders)
   427  - When downloading the contents of the linked folder and sub contents are downloaded
   428  - When uploading to a shortcut folder the file will be placed in the linked folder
   429  - When server-side moving (renaming) the shortcut is renamed, not the destination folder
   430  - When server-side copying the contents of the linked folder is copied, not the shortcut.
   431  - When deleting with `rclone rmdir` or `rclone purge` the shortcut is deleted not the linked folder.
   432  - **NB** When deleting with `rclone remove` or `rclone mount` the contents of the linked folder will be deleted.
   433  
   434  The [rclone backend](https://rclone.org/commands/rclone_backend/) command can be used to create shortcuts.  
   435  
   436  Shortcuts can be completely ignored with the `--drive-skip-shortcuts` flag
   437  or the corresponding `skip_shortcuts` configuration setting.
   438  
   439  If you have shortcuts that lead to an infinite recursion in your drive (e.g. a shortcut pointing to a parent folder), `skip_shortcuts` might be mandatory to be able to copy the drive.
   440  
   441  ### Emptying trash
   442  
   443  If you wish to empty your trash you can use the `rclone cleanup remote:`
   444  command which will permanently delete all your trashed files. This command
   445  does not take any path arguments.
   446  
   447  Note that Google Drive takes some time (minutes to days) to empty the
   448  trash even though the command returns within a few seconds.  No output
   449  is echoed, so there will be no confirmation even using -v or -vv.
   450  
   451  ### Quota information
   452  
   453  To view your current quota you can use the `rclone about remote:`
   454  command which will display your usage limit (quota), the usage in Google
   455  Drive, the size of all files in the Trash and the space used by other
   456  Google services such as Gmail. This command does not take any path
   457  arguments.
   458  
   459  #### Import/Export of google documents
   460  
   461  Google documents can be exported from and uploaded to Google Drive.
   462  
   463  When rclone downloads a Google doc it chooses a format to download
   464  depending upon the `--drive-export-formats` setting.
   465  By default the export formats are `docx,xlsx,pptx,svg` which are a
   466  sensible default for an editable document.
   467  
   468  When choosing a format, rclone runs down the list provided in order
   469  and chooses the first file format the doc can be exported as from the
   470  list. If the file can't be exported to a format on the formats list,
   471  then rclone will choose a format from the default list.
   472  
   473  If you prefer an archive copy then you might use `--drive-export-formats
   474  pdf`, or if you prefer openoffice/libreoffice formats you might use
   475  `--drive-export-formats ods,odt,odp`.
   476  
   477  Note that rclone adds the extension to the google doc, so if it is
   478  called `My Spreadsheet` on google docs, it will be exported as `My
   479  Spreadsheet.xlsx` or `My Spreadsheet.pdf` etc.
   480  
   481  When importing files into Google Drive, rclone will convert all
   482  files with an extension in `--drive-import-formats` to their
   483  associated document type.
   484  rclone will not convert any files by default, since the conversion
   485  is lossy process.
   486  
   487  The conversion must result in a file with the same extension when
   488  the `--drive-export-formats` rules are applied to the uploaded document.
   489  
   490  Here are some examples for allowed and prohibited conversions.
   491  
   492  | export-formats | import-formats | Upload Ext | Document Ext | Allowed |
   493  | -------------- | -------------- | ---------- | ------------ | ------- |
   494  | odt | odt | odt | odt | Yes |
   495  | odt | docx,odt | odt | odt | Yes |
   496  |  | docx | docx | docx | Yes |
   497  |  | odt | odt | docx | No |
   498  | odt,docx | docx,odt | docx | odt | No |
   499  | docx,odt | docx,odt | docx | docx | Yes |
   500  | docx,odt | docx,odt | odt | docx | No |
   501  
   502  This limitation can be disabled by specifying `--drive-allow-import-name-change`.
   503  When using this flag, rclone can convert multiple files types resulting
   504  in the same document type at once, e.g. with `--drive-import-formats docx,odt,txt`,
   505  all files having these extension would result in a document represented as a docx file.
   506  This brings the additional risk of overwriting a document, if multiple files
   507  have the same stem. Many rclone operations will not handle this name change
   508  in any way. They assume an equal name when copying files and might copy the
   509  file again or delete them when the name changes. 
   510  
   511  Here are the possible export extensions with their corresponding mime types.
   512  Most of these can also be used for importing, but there more that are not
   513  listed here. Some of these additional ones might only be available when
   514  the operating system provides the correct MIME type entries.
   515  
   516  This list can be changed by Google Drive at any time and might not
   517  represent the currently available conversions.
   518  
   519  | Extension | Mime Type | Description |
   520  | --------- |-----------| ------------|
   521  | bmp  | image/bmp | Windows Bitmap format |
   522  | csv  | text/csv | Standard CSV format for Spreadsheets |
   523  | doc  | application/msword | Classic Word file |
   524  | docx | application/vnd.openxmlformats-officedocument.wordprocessingml.document | Microsoft Office Document |
   525  | epub | application/epub+zip | E-book format |
   526  | html | text/html | An HTML Document |
   527  | jpg  | image/jpeg | A JPEG Image File |
   528  | json | application/vnd.google-apps.script+json | JSON Text Format for Google Apps scripts |
   529  | odp  | application/vnd.oasis.opendocument.presentation | Openoffice Presentation |
   530  | ods  | application/vnd.oasis.opendocument.spreadsheet | Openoffice Spreadsheet |
   531  | ods  | application/x-vnd.oasis.opendocument.spreadsheet | Openoffice Spreadsheet |
   532  | odt  | application/vnd.oasis.opendocument.text | Openoffice Document |
   533  | pdf  | application/pdf | Adobe PDF Format |
   534  | pjpeg | image/pjpeg | Progressive JPEG Image |
   535  | png  | image/png | PNG Image Format|
   536  | pptx | application/vnd.openxmlformats-officedocument.presentationml.presentation | Microsoft Office Powerpoint |
   537  | rtf  | application/rtf | Rich Text Format |
   538  | svg  | image/svg+xml | Scalable Vector Graphics Format |
   539  | tsv  | text/tab-separated-values | Standard TSV format for spreadsheets |
   540  | txt  | text/plain | Plain Text |
   541  | wmf  | application/x-msmetafile | Windows Meta File |
   542  | xls  | application/vnd.ms-excel | Classic Excel file |
   543  | xlsx | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | Microsoft Office Spreadsheet |
   544  | zip  | application/zip | A ZIP file of HTML, Images CSS |
   545  
   546  Google documents can also be exported as link files. These files will
   547  open a browser window for the Google Docs website of that document
   548  when opened. The link file extension has to be specified as a
   549  `--drive-export-formats` parameter. They will match all available
   550  Google Documents.
   551  
   552  | Extension | Description | OS Support |
   553  | --------- | ----------- | ---------- |
   554  | desktop | freedesktop.org specified desktop entry | Linux |
   555  | link.html | An HTML Document with a redirect | All |
   556  | url | INI style link file | macOS, Windows |
   557  | webloc | macOS specific XML format | macOS |
   558  
   559  {{< rem autogenerated options start" - DO NOT EDIT - instead edit fs.RegInfo in backend/drive/drive.go then run make backenddocs" >}}
   560  ### Standard options
   561  
   562  Here are the Standard options specific to drive (Google Drive).
   563  
   564  #### --drive-client-id
   565  
   566  Google Application Client Id
   567  Setting your own is recommended.
   568  See https://rclone.org/drive/#making-your-own-client-id for how to create your own.
   569  If you leave this blank, it will use an internal key which is low performance.
   570  
   571  Properties:
   572  
   573  - Config:      client_id
   574  - Env Var:     RCLONE_DRIVE_CLIENT_ID
   575  - Type:        string
   576  - Required:    false
   577  
   578  #### --drive-client-secret
   579  
   580  OAuth Client Secret.
   581  
   582  Leave blank normally.
   583  
   584  Properties:
   585  
   586  - Config:      client_secret
   587  - Env Var:     RCLONE_DRIVE_CLIENT_SECRET
   588  - Type:        string
   589  - Required:    false
   590  
   591  #### --drive-scope
   592  
   593  Comma separated list of scopes that rclone should use when requesting access from drive.
   594  
   595  Properties:
   596  
   597  - Config:      scope
   598  - Env Var:     RCLONE_DRIVE_SCOPE
   599  - Type:        string
   600  - Required:    false
   601  - Examples:
   602      - "drive"
   603          - Full access all files, excluding Application Data Folder.
   604      - "drive.readonly"
   605          - Read-only access to file metadata and file contents.
   606      - "drive.file"
   607          - Access to files created by rclone only.
   608          - These are visible in the drive website.
   609          - File authorization is revoked when the user deauthorizes the app.
   610      - "drive.appfolder"
   611          - Allows read and write access to the Application Data folder.
   612          - This is not visible in the drive website.
   613      - "drive.metadata.readonly"
   614          - Allows read-only access to file metadata but
   615          - does not allow any access to read or download file content.
   616  
   617  #### --drive-service-account-file
   618  
   619  Service Account Credentials JSON file path.
   620  
   621  Leave blank normally.
   622  Needed only if you want use SA instead of interactive login.
   623  
   624  Leading `~` will be expanded in the file name as will environment variables such as `${RCLONE_CONFIG_DIR}`.
   625  
   626  Properties:
   627  
   628  - Config:      service_account_file
   629  - Env Var:     RCLONE_DRIVE_SERVICE_ACCOUNT_FILE
   630  - Type:        string
   631  - Required:    false
   632  
   633  #### --drive-alternate-export
   634  
   635  Deprecated: No longer needed.
   636  
   637  Properties:
   638  
   639  - Config:      alternate_export
   640  - Env Var:     RCLONE_DRIVE_ALTERNATE_EXPORT
   641  - Type:        bool
   642  - Default:     false
   643  
   644  ### Advanced options
   645  
   646  Here are the Advanced options specific to drive (Google Drive).
   647  
   648  #### --drive-token
   649  
   650  OAuth Access Token as a JSON blob.
   651  
   652  Properties:
   653  
   654  - Config:      token
   655  - Env Var:     RCLONE_DRIVE_TOKEN
   656  - Type:        string
   657  - Required:    false
   658  
   659  #### --drive-auth-url
   660  
   661  Auth server URL.
   662  
   663  Leave blank to use the provider defaults.
   664  
   665  Properties:
   666  
   667  - Config:      auth_url
   668  - Env Var:     RCLONE_DRIVE_AUTH_URL
   669  - Type:        string
   670  - Required:    false
   671  
   672  #### --drive-token-url
   673  
   674  Token server url.
   675  
   676  Leave blank to use the provider defaults.
   677  
   678  Properties:
   679  
   680  - Config:      token_url
   681  - Env Var:     RCLONE_DRIVE_TOKEN_URL
   682  - Type:        string
   683  - Required:    false
   684  
   685  #### --drive-root-folder-id
   686  
   687  ID of the root folder.
   688  Leave blank normally.
   689  
   690  Fill in to access "Computers" folders (see docs), or for rclone to use
   691  a non root folder as its starting point.
   692  
   693  
   694  Properties:
   695  
   696  - Config:      root_folder_id
   697  - Env Var:     RCLONE_DRIVE_ROOT_FOLDER_ID
   698  - Type:        string
   699  - Required:    false
   700  
   701  #### --drive-service-account-credentials
   702  
   703  Service Account Credentials JSON blob.
   704  
   705  Leave blank normally.
   706  Needed only if you want use SA instead of interactive login.
   707  
   708  Properties:
   709  
   710  - Config:      service_account_credentials
   711  - Env Var:     RCLONE_DRIVE_SERVICE_ACCOUNT_CREDENTIALS
   712  - Type:        string
   713  - Required:    false
   714  
   715  #### --drive-team-drive
   716  
   717  ID of the Shared Drive (Team Drive).
   718  
   719  Properties:
   720  
   721  - Config:      team_drive
   722  - Env Var:     RCLONE_DRIVE_TEAM_DRIVE
   723  - Type:        string
   724  - Required:    false
   725  
   726  #### --drive-auth-owner-only
   727  
   728  Only consider files owned by the authenticated user.
   729  
   730  Properties:
   731  
   732  - Config:      auth_owner_only
   733  - Env Var:     RCLONE_DRIVE_AUTH_OWNER_ONLY
   734  - Type:        bool
   735  - Default:     false
   736  
   737  #### --drive-use-trash
   738  
   739  Send files to the trash instead of deleting permanently.
   740  
   741  Defaults to true, namely sending files to the trash.
   742  Use `--drive-use-trash=false` to delete files permanently instead.
   743  
   744  Properties:
   745  
   746  - Config:      use_trash
   747  - Env Var:     RCLONE_DRIVE_USE_TRASH
   748  - Type:        bool
   749  - Default:     true
   750  
   751  #### --drive-copy-shortcut-content
   752  
   753  Server side copy contents of shortcuts instead of the shortcut.
   754  
   755  When doing server side copies, normally rclone will copy shortcuts as
   756  shortcuts.
   757  
   758  If this flag is used then rclone will copy the contents of shortcuts
   759  rather than shortcuts themselves when doing server side copies.
   760  
   761  Properties:
   762  
   763  - Config:      copy_shortcut_content
   764  - Env Var:     RCLONE_DRIVE_COPY_SHORTCUT_CONTENT
   765  - Type:        bool
   766  - Default:     false
   767  
   768  #### --drive-skip-gdocs
   769  
   770  Skip google documents in all listings.
   771  
   772  If given, gdocs practically become invisible to rclone.
   773  
   774  Properties:
   775  
   776  - Config:      skip_gdocs
   777  - Env Var:     RCLONE_DRIVE_SKIP_GDOCS
   778  - Type:        bool
   779  - Default:     false
   780  
   781  #### --drive-show-all-gdocs
   782  
   783  Show all Google Docs including non-exportable ones in listings.
   784  
   785  If you try a server side copy on a Google Form without this flag, you
   786  will get this error:
   787  
   788      No export formats found for "application/vnd.google-apps.form"
   789  
   790  However adding this flag will allow the form to be server side copied.
   791  
   792  Note that rclone doesn't add extensions to the Google Docs file names
   793  in this mode.
   794  
   795  Do **not** use this flag when trying to download Google Docs - rclone
   796  will fail to download them.
   797  
   798  
   799  Properties:
   800  
   801  - Config:      show_all_gdocs
   802  - Env Var:     RCLONE_DRIVE_SHOW_ALL_GDOCS
   803  - Type:        bool
   804  - Default:     false
   805  
   806  #### --drive-skip-checksum-gphotos
   807  
   808  Skip checksums on Google photos and videos only.
   809  
   810  Use this if you get checksum errors when transferring Google photos or
   811  videos.
   812  
   813  Setting this flag will cause Google photos and videos to return a
   814  blank checksums.
   815  
   816  Google photos are identified by being in the "photos" space.
   817  
   818  Corrupted checksums are caused by Google modifying the image/video but
   819  not updating the checksum.
   820  
   821  Properties:
   822  
   823  - Config:      skip_checksum_gphotos
   824  - Env Var:     RCLONE_DRIVE_SKIP_CHECKSUM_GPHOTOS
   825  - Type:        bool
   826  - Default:     false
   827  
   828  #### --drive-shared-with-me
   829  
   830  Only show files that are shared with me.
   831  
   832  Instructs rclone to operate on your "Shared with me" folder (where
   833  Google Drive lets you access the files and folders others have shared
   834  with you).
   835  
   836  This works both with the "list" (lsd, lsl, etc.) and the "copy"
   837  commands (copy, sync, etc.), and with all other commands too.
   838  
   839  Properties:
   840  
   841  - Config:      shared_with_me
   842  - Env Var:     RCLONE_DRIVE_SHARED_WITH_ME
   843  - Type:        bool
   844  - Default:     false
   845  
   846  #### --drive-trashed-only
   847  
   848  Only show files that are in the trash.
   849  
   850  This will show trashed files in their original directory structure.
   851  
   852  Properties:
   853  
   854  - Config:      trashed_only
   855  - Env Var:     RCLONE_DRIVE_TRASHED_ONLY
   856  - Type:        bool
   857  - Default:     false
   858  
   859  #### --drive-starred-only
   860  
   861  Only show files that are starred.
   862  
   863  Properties:
   864  
   865  - Config:      starred_only
   866  - Env Var:     RCLONE_DRIVE_STARRED_ONLY
   867  - Type:        bool
   868  - Default:     false
   869  
   870  #### --drive-formats
   871  
   872  Deprecated: See export_formats.
   873  
   874  Properties:
   875  
   876  - Config:      formats
   877  - Env Var:     RCLONE_DRIVE_FORMATS
   878  - Type:        string
   879  - Required:    false
   880  
   881  #### --drive-export-formats
   882  
   883  Comma separated list of preferred formats for downloading Google docs.
   884  
   885  Properties:
   886  
   887  - Config:      export_formats
   888  - Env Var:     RCLONE_DRIVE_EXPORT_FORMATS
   889  - Type:        string
   890  - Default:     "docx,xlsx,pptx,svg"
   891  
   892  #### --drive-import-formats
   893  
   894  Comma separated list of preferred formats for uploading Google docs.
   895  
   896  Properties:
   897  
   898  - Config:      import_formats
   899  - Env Var:     RCLONE_DRIVE_IMPORT_FORMATS
   900  - Type:        string
   901  - Required:    false
   902  
   903  #### --drive-allow-import-name-change
   904  
   905  Allow the filetype to change when uploading Google docs.
   906  
   907  E.g. file.doc to file.docx. This will confuse sync and reupload every time.
   908  
   909  Properties:
   910  
   911  - Config:      allow_import_name_change
   912  - Env Var:     RCLONE_DRIVE_ALLOW_IMPORT_NAME_CHANGE
   913  - Type:        bool
   914  - Default:     false
   915  
   916  #### --drive-use-created-date
   917  
   918  Use file created date instead of modified date.
   919  
   920  Useful when downloading data and you want the creation date used in
   921  place of the last modified date.
   922  
   923  **WARNING**: This flag may have some unexpected consequences.
   924  
   925  When uploading to your drive all files will be overwritten unless they
   926  haven't been modified since their creation. And the inverse will occur
   927  while downloading.  This side effect can be avoided by using the
   928  "--checksum" flag.
   929  
   930  This feature was implemented to retain photos capture date as recorded
   931  by google photos. You will first need to check the "Create a Google
   932  Photos folder" option in your google drive settings. You can then copy
   933  or move the photos locally and use the date the image was taken
   934  (created) set as the modification date.
   935  
   936  Properties:
   937  
   938  - Config:      use_created_date
   939  - Env Var:     RCLONE_DRIVE_USE_CREATED_DATE
   940  - Type:        bool
   941  - Default:     false
   942  
   943  #### --drive-use-shared-date
   944  
   945  Use date file was shared instead of modified date.
   946  
   947  Note that, as with "--drive-use-created-date", this flag may have
   948  unexpected consequences when uploading/downloading files.
   949  
   950  If both this flag and "--drive-use-created-date" are set, the created
   951  date is used.
   952  
   953  Properties:
   954  
   955  - Config:      use_shared_date
   956  - Env Var:     RCLONE_DRIVE_USE_SHARED_DATE
   957  - Type:        bool
   958  - Default:     false
   959  
   960  #### --drive-list-chunk
   961  
   962  Size of listing chunk 100-1000, 0 to disable.
   963  
   964  Properties:
   965  
   966  - Config:      list_chunk
   967  - Env Var:     RCLONE_DRIVE_LIST_CHUNK
   968  - Type:        int
   969  - Default:     1000
   970  
   971  #### --drive-impersonate
   972  
   973  Impersonate this user when using a service account.
   974  
   975  Properties:
   976  
   977  - Config:      impersonate
   978  - Env Var:     RCLONE_DRIVE_IMPERSONATE
   979  - Type:        string
   980  - Required:    false
   981  
   982  #### --drive-upload-cutoff
   983  
   984  Cutoff for switching to chunked upload.
   985  
   986  Properties:
   987  
   988  - Config:      upload_cutoff
   989  - Env Var:     RCLONE_DRIVE_UPLOAD_CUTOFF
   990  - Type:        SizeSuffix
   991  - Default:     8Mi
   992  
   993  #### --drive-chunk-size
   994  
   995  Upload chunk size.
   996  
   997  Must a power of 2 >= 256k.
   998  
   999  Making this larger will improve performance, but note that each chunk
  1000  is buffered in memory one per transfer.
  1001  
  1002  Reducing this will reduce memory usage but decrease performance.
  1003  
  1004  Properties:
  1005  
  1006  - Config:      chunk_size
  1007  - Env Var:     RCLONE_DRIVE_CHUNK_SIZE
  1008  - Type:        SizeSuffix
  1009  - Default:     8Mi
  1010  
  1011  #### --drive-acknowledge-abuse
  1012  
  1013  Set to allow files which return cannotDownloadAbusiveFile to be downloaded.
  1014  
  1015  If downloading a file returns the error "This file has been identified
  1016  as malware or spam and cannot be downloaded" with the error code
  1017  "cannotDownloadAbusiveFile" then supply this flag to rclone to
  1018  indicate you acknowledge the risks of downloading the file and rclone
  1019  will download it anyway.
  1020  
  1021  Note that if you are using service account it will need Manager
  1022  permission (not Content Manager) to for this flag to work. If the SA
  1023  does not have the right permission, Google will just ignore the flag.
  1024  
  1025  Properties:
  1026  
  1027  - Config:      acknowledge_abuse
  1028  - Env Var:     RCLONE_DRIVE_ACKNOWLEDGE_ABUSE
  1029  - Type:        bool
  1030  - Default:     false
  1031  
  1032  #### --drive-keep-revision-forever
  1033  
  1034  Keep new head revision of each file forever.
  1035  
  1036  Properties:
  1037  
  1038  - Config:      keep_revision_forever
  1039  - Env Var:     RCLONE_DRIVE_KEEP_REVISION_FOREVER
  1040  - Type:        bool
  1041  - Default:     false
  1042  
  1043  #### --drive-size-as-quota
  1044  
  1045  Show sizes as storage quota usage, not actual size.
  1046  
  1047  Show the size of a file as the storage quota used. This is the
  1048  current version plus any older versions that have been set to keep
  1049  forever.
  1050  
  1051  **WARNING**: This flag may have some unexpected consequences.
  1052  
  1053  It is not recommended to set this flag in your config - the
  1054  recommended usage is using the flag form --drive-size-as-quota when
  1055  doing rclone ls/lsl/lsf/lsjson/etc only.
  1056  
  1057  If you do use this flag for syncing (not recommended) then you will
  1058  need to use --ignore size also.
  1059  
  1060  Properties:
  1061  
  1062  - Config:      size_as_quota
  1063  - Env Var:     RCLONE_DRIVE_SIZE_AS_QUOTA
  1064  - Type:        bool
  1065  - Default:     false
  1066  
  1067  #### --drive-v2-download-min-size
  1068  
  1069  If Object's are greater, use drive v2 API to download.
  1070  
  1071  Properties:
  1072  
  1073  - Config:      v2_download_min_size
  1074  - Env Var:     RCLONE_DRIVE_V2_DOWNLOAD_MIN_SIZE
  1075  - Type:        SizeSuffix
  1076  - Default:     off
  1077  
  1078  #### --drive-pacer-min-sleep
  1079  
  1080  Minimum time to sleep between API calls.
  1081  
  1082  Properties:
  1083  
  1084  - Config:      pacer_min_sleep
  1085  - Env Var:     RCLONE_DRIVE_PACER_MIN_SLEEP
  1086  - Type:        Duration
  1087  - Default:     100ms
  1088  
  1089  #### --drive-pacer-burst
  1090  
  1091  Number of API calls to allow without sleeping.
  1092  
  1093  Properties:
  1094  
  1095  - Config:      pacer_burst
  1096  - Env Var:     RCLONE_DRIVE_PACER_BURST
  1097  - Type:        int
  1098  - Default:     100
  1099  
  1100  #### --drive-server-side-across-configs
  1101  
  1102  Deprecated: use --server-side-across-configs instead.
  1103  
  1104  Allow server-side operations (e.g. copy) to work across different drive configs.
  1105  
  1106  This can be useful if you wish to do a server-side copy between two
  1107  different Google drives.  Note that this isn't enabled by default
  1108  because it isn't easy to tell if it will work between any two
  1109  configurations.
  1110  
  1111  Properties:
  1112  
  1113  - Config:      server_side_across_configs
  1114  - Env Var:     RCLONE_DRIVE_SERVER_SIDE_ACROSS_CONFIGS
  1115  - Type:        bool
  1116  - Default:     false
  1117  
  1118  #### --drive-disable-http2
  1119  
  1120  Disable drive using http2.
  1121  
  1122  There is currently an unsolved issue with the google drive backend and
  1123  HTTP/2.  HTTP/2 is therefore disabled by default for the drive backend
  1124  but can be re-enabled here.  When the issue is solved this flag will
  1125  be removed.
  1126  
  1127  See: https://github.com/artpar/artpar/issues/3631
  1128  
  1129  
  1130  
  1131  Properties:
  1132  
  1133  - Config:      disable_http2
  1134  - Env Var:     RCLONE_DRIVE_DISABLE_HTTP2
  1135  - Type:        bool
  1136  - Default:     true
  1137  
  1138  #### --drive-stop-on-upload-limit
  1139  
  1140  Make upload limit errors be fatal.
  1141  
  1142  At the time of writing it is only possible to upload 750 GiB of data to
  1143  Google Drive a day (this is an undocumented limit). When this limit is
  1144  reached Google Drive produces a slightly different error message. When
  1145  this flag is set it causes these errors to be fatal.  These will stop
  1146  the in-progress sync.
  1147  
  1148  Note that this detection is relying on error message strings which
  1149  Google don't document so it may break in the future.
  1150  
  1151  See: https://github.com/artpar/artpar/issues/3857
  1152  
  1153  
  1154  Properties:
  1155  
  1156  - Config:      stop_on_upload_limit
  1157  - Env Var:     RCLONE_DRIVE_STOP_ON_UPLOAD_LIMIT
  1158  - Type:        bool
  1159  - Default:     false
  1160  
  1161  #### --drive-stop-on-download-limit
  1162  
  1163  Make download limit errors be fatal.
  1164  
  1165  At the time of writing it is only possible to download 10 TiB of data from
  1166  Google Drive a day (this is an undocumented limit). When this limit is
  1167  reached Google Drive produces a slightly different error message. When
  1168  this flag is set it causes these errors to be fatal.  These will stop
  1169  the in-progress sync.
  1170  
  1171  Note that this detection is relying on error message strings which
  1172  Google don't document so it may break in the future.
  1173  
  1174  
  1175  Properties:
  1176  
  1177  - Config:      stop_on_download_limit
  1178  - Env Var:     RCLONE_DRIVE_STOP_ON_DOWNLOAD_LIMIT
  1179  - Type:        bool
  1180  - Default:     false
  1181  
  1182  #### --drive-skip-shortcuts
  1183  
  1184  If set skip shortcut files.
  1185  
  1186  Normally rclone dereferences shortcut files making them appear as if
  1187  they are the original file (see [the shortcuts section](#shortcuts)).
  1188  If this flag is set then rclone will ignore shortcut files completely.
  1189  
  1190  
  1191  Properties:
  1192  
  1193  - Config:      skip_shortcuts
  1194  - Env Var:     RCLONE_DRIVE_SKIP_SHORTCUTS
  1195  - Type:        bool
  1196  - Default:     false
  1197  
  1198  #### --drive-skip-dangling-shortcuts
  1199  
  1200  If set skip dangling shortcut files.
  1201  
  1202  If this is set then rclone will not show any dangling shortcuts in listings.
  1203  
  1204  
  1205  Properties:
  1206  
  1207  - Config:      skip_dangling_shortcuts
  1208  - Env Var:     RCLONE_DRIVE_SKIP_DANGLING_SHORTCUTS
  1209  - Type:        bool
  1210  - Default:     false
  1211  
  1212  #### --drive-resource-key
  1213  
  1214  Resource key for accessing a link-shared file.
  1215  
  1216  If you need to access files shared with a link like this
  1217  
  1218      https://drive.google.com/drive/folders/XXX?resourcekey=YYY&usp=sharing
  1219  
  1220  Then you will need to use the first part "XXX" as the "root_folder_id"
  1221  and the second part "YYY" as the "resource_key" otherwise you will get
  1222  404 not found errors when trying to access the directory.
  1223  
  1224  See: https://developers.google.com/drive/api/guides/resource-keys
  1225  
  1226  This resource key requirement only applies to a subset of old files.
  1227  
  1228  Note also that opening the folder once in the web interface (with the
  1229  user you've authenticated rclone with) seems to be enough so that the
  1230  resource key is not needed.
  1231  
  1232  
  1233  Properties:
  1234  
  1235  - Config:      resource_key
  1236  - Env Var:     RCLONE_DRIVE_RESOURCE_KEY
  1237  - Type:        string
  1238  - Required:    false
  1239  
  1240  #### --drive-fast-list-bug-fix
  1241  
  1242  Work around a bug in Google Drive listing.
  1243  
  1244  Normally rclone will work around a bug in Google Drive when using
  1245  --fast-list (ListR) where the search "(A in parents) or (B in
  1246  parents)" returns nothing sometimes. See #3114, #4289 and
  1247  https://issuetracker.google.com/issues/149522397
  1248  
  1249  Rclone detects this by finding no items in more than one directory
  1250  when listing and retries them as lists of individual directories.
  1251  
  1252  This means that if you have a lot of empty directories rclone will end
  1253  up listing them all individually and this can take many more API
  1254  calls.
  1255  
  1256  This flag allows the work-around to be disabled. This is **not**
  1257  recommended in normal use - only if you have a particular case you are
  1258  having trouble with like many empty directories.
  1259  
  1260  
  1261  Properties:
  1262  
  1263  - Config:      fast_list_bug_fix
  1264  - Env Var:     RCLONE_DRIVE_FAST_LIST_BUG_FIX
  1265  - Type:        bool
  1266  - Default:     true
  1267  
  1268  #### --drive-metadata-owner
  1269  
  1270  Control whether owner should be read or written in metadata.
  1271  
  1272  Owner is a standard part of the file metadata so is easy to read. But it
  1273  isn't always desirable to set the owner from the metadata.
  1274  
  1275  Note that you can't set the owner on Shared Drives, and that setting
  1276  ownership will generate an email to the new owner (this can't be
  1277  disabled), and you can't transfer ownership to someone outside your
  1278  organization.
  1279  
  1280  
  1281  Properties:
  1282  
  1283  - Config:      metadata_owner
  1284  - Env Var:     RCLONE_DRIVE_METADATA_OWNER
  1285  - Type:        Bits
  1286  - Default:     read
  1287  - Examples:
  1288      - "off"
  1289          - Do not read or write the value
  1290      - "read"
  1291          - Read the value only
  1292      - "write"
  1293          - Write the value only
  1294      - "read,write"
  1295          - Read and Write the value.
  1296  
  1297  #### --drive-metadata-permissions
  1298  
  1299  Control whether permissions should be read or written in metadata.
  1300  
  1301  Reading permissions metadata from files can be done quickly, but it
  1302  isn't always desirable to set the permissions from the metadata.
  1303  
  1304  Note that rclone drops any inherited permissions on Shared Drives and
  1305  any owner permission on My Drives as these are duplicated in the owner
  1306  metadata.
  1307  
  1308  
  1309  Properties:
  1310  
  1311  - Config:      metadata_permissions
  1312  - Env Var:     RCLONE_DRIVE_METADATA_PERMISSIONS
  1313  - Type:        Bits
  1314  - Default:     off
  1315  - Examples:
  1316      - "off"
  1317          - Do not read or write the value
  1318      - "read"
  1319          - Read the value only
  1320      - "write"
  1321          - Write the value only
  1322      - "read,write"
  1323          - Read and Write the value.
  1324  
  1325  #### --drive-metadata-labels
  1326  
  1327  Control whether labels should be read or written in metadata.
  1328  
  1329  Reading labels metadata from files takes an extra API transaction and
  1330  will slow down listings. It isn't always desirable to set the labels
  1331  from the metadata.
  1332  
  1333  The format of labels is documented in the drive API documentation at
  1334  https://developers.google.com/drive/api/reference/rest/v3/Label -
  1335  rclone just provides a JSON dump of this format.
  1336  
  1337  When setting labels, the label and fields must already exist - rclone
  1338  will not create them. This means that if you are transferring labels
  1339  from two different accounts you will have to create the labels in
  1340  advance and use the metadata mapper to translate the IDs between the
  1341  two accounts.
  1342  
  1343  
  1344  Properties:
  1345  
  1346  - Config:      metadata_labels
  1347  - Env Var:     RCLONE_DRIVE_METADATA_LABELS
  1348  - Type:        Bits
  1349  - Default:     off
  1350  - Examples:
  1351      - "off"
  1352          - Do not read or write the value
  1353      - "read"
  1354          - Read the value only
  1355      - "write"
  1356          - Write the value only
  1357      - "read,write"
  1358          - Read and Write the value.
  1359  
  1360  #### --drive-encoding
  1361  
  1362  The encoding for the backend.
  1363  
  1364  See the [encoding section in the overview](/overview/#encoding) for more info.
  1365  
  1366  Properties:
  1367  
  1368  - Config:      encoding
  1369  - Env Var:     RCLONE_DRIVE_ENCODING
  1370  - Type:        Encoding
  1371  - Default:     InvalidUtf8
  1372  
  1373  #### --drive-env-auth
  1374  
  1375  Get IAM credentials from runtime (environment variables or instance meta data if no env vars).
  1376  
  1377  Only applies if service_account_file and service_account_credentials is blank.
  1378  
  1379  Properties:
  1380  
  1381  - Config:      env_auth
  1382  - Env Var:     RCLONE_DRIVE_ENV_AUTH
  1383  - Type:        bool
  1384  - Default:     false
  1385  - Examples:
  1386      - "false"
  1387          - Enter credentials in the next step.
  1388      - "true"
  1389          - Get GCP IAM credentials from the environment (env vars or IAM).
  1390  
  1391  #### --drive-description
  1392  
  1393  Description of the remote
  1394  
  1395  Properties:
  1396  
  1397  - Config:      description
  1398  - Env Var:     RCLONE_DRIVE_DESCRIPTION
  1399  - Type:        string
  1400  - Required:    false
  1401  
  1402  ### Metadata
  1403  
  1404  User metadata is stored in the properties field of the drive object.
  1405  
  1406  Metadata is supported on files and directories.
  1407  
  1408  Here are the possible system metadata items for the drive backend.
  1409  
  1410  | Name | Help | Type | Example | Read Only |
  1411  |------|------|------|---------|-----------|
  1412  | btime | Time of file birth (creation) with mS accuracy. Note that this is only writable on fresh uploads - it can't be written for updates. | RFC 3339 | 2006-01-02T15:04:05.999Z07:00 | N |
  1413  | content-type | The MIME type of the file. | string | text/plain | N |
  1414  | copy-requires-writer-permission | Whether the options to copy, print, or download this file, should be disabled for readers and commenters. | boolean | true | N |
  1415  | description | A short description of the file. | string | Contract for signing | N |
  1416  | folder-color-rgb | The color for a folder or a shortcut to a folder as an RGB hex string. | string | 881133 | N |
  1417  | labels | Labels attached to this file in a JSON dump of Googled drive format. Enable with --drive-metadata-labels. | JSON | [] | N |
  1418  | mtime | Time of last modification with mS accuracy. | RFC 3339 | 2006-01-02T15:04:05.999Z07:00 | N |
  1419  | owner | The owner of the file. Usually an email address. Enable with --drive-metadata-owner. | string | user@example.com | N |
  1420  | permissions | Permissions in a JSON dump of Google drive format. On shared drives these will only be present if they aren't inherited. Enable with --drive-metadata-permissions. | JSON | {} | N |
  1421  | starred | Whether the user has starred the file. | boolean | false | N |
  1422  | viewed-by-me | Whether the file has been viewed by this user. | boolean | true | **Y** |
  1423  | writers-can-share | Whether users with only writer permission can modify the file's permissions. Not populated for items in shared drives. | boolean | false | N |
  1424  
  1425  See the [metadata](/docs/#metadata) docs for more info.
  1426  
  1427  ## Backend commands
  1428  
  1429  Here are the commands specific to the drive backend.
  1430  
  1431  Run them with
  1432  
  1433      rclone backend COMMAND remote:
  1434  
  1435  The help below will explain what arguments each command takes.
  1436  
  1437  See the [backend](/commands/rclone_backend/) command for more
  1438  info on how to pass options and arguments.
  1439  
  1440  These can be run on a running backend using the rc command
  1441  [backend/command](/rc/#backend-command).
  1442  
  1443  ### get
  1444  
  1445  Get command for fetching the drive config parameters
  1446  
  1447      rclone backend get remote: [options] [<arguments>+]
  1448  
  1449  This is a get command which will be used to fetch the various drive config parameters
  1450  
  1451  Usage Examples:
  1452  
  1453      rclone backend get drive: [-o service_account_file] [-o chunk_size]
  1454      rclone rc backend/command command=get fs=drive: [-o service_account_file] [-o chunk_size]
  1455  
  1456  
  1457  Options:
  1458  
  1459  - "chunk_size": show the current upload chunk size
  1460  - "service_account_file": show the current service account file
  1461  
  1462  ### set
  1463  
  1464  Set command for updating the drive config parameters
  1465  
  1466      rclone backend set remote: [options] [<arguments>+]
  1467  
  1468  This is a set command which will be used to update the various drive config parameters
  1469  
  1470  Usage Examples:
  1471  
  1472      rclone backend set drive: [-o service_account_file=sa.json] [-o chunk_size=67108864]
  1473      rclone rc backend/command command=set fs=drive: [-o service_account_file=sa.json] [-o chunk_size=67108864]
  1474  
  1475  
  1476  Options:
  1477  
  1478  - "chunk_size": update the current upload chunk size
  1479  - "service_account_file": update the current service account file
  1480  
  1481  ### shortcut
  1482  
  1483  Create shortcuts from files or directories
  1484  
  1485      rclone backend shortcut remote: [options] [<arguments>+]
  1486  
  1487  This command creates shortcuts from files or directories.
  1488  
  1489  Usage:
  1490  
  1491      rclone backend shortcut drive: source_item destination_shortcut
  1492      rclone backend shortcut drive: source_item -o target=drive2: destination_shortcut
  1493  
  1494  In the first example this creates a shortcut from the "source_item"
  1495  which can be a file or a directory to the "destination_shortcut". The
  1496  "source_item" and the "destination_shortcut" should be relative paths
  1497  from "drive:"
  1498  
  1499  In the second example this creates a shortcut from the "source_item"
  1500  relative to "drive:" to the "destination_shortcut" relative to
  1501  "drive2:". This may fail with a permission error if the user
  1502  authenticated with "drive2:" can't read files from "drive:".
  1503  
  1504  
  1505  Options:
  1506  
  1507  - "target": optional target remote for the shortcut destination
  1508  
  1509  ### drives
  1510  
  1511  List the Shared Drives available to this account
  1512  
  1513      rclone backend drives remote: [options] [<arguments>+]
  1514  
  1515  This command lists the Shared Drives (Team Drives) available to this
  1516  account.
  1517  
  1518  Usage:
  1519  
  1520      rclone backend [-o config] drives drive:
  1521  
  1522  This will return a JSON list of objects like this
  1523  
  1524      [
  1525          {
  1526              "id": "0ABCDEF-01234567890",
  1527              "kind": "drive#teamDrive",
  1528              "name": "My Drive"
  1529          },
  1530          {
  1531              "id": "0ABCDEFabcdefghijkl",
  1532              "kind": "drive#teamDrive",
  1533              "name": "Test Drive"
  1534          }
  1535      ]
  1536  
  1537  With the -o config parameter it will output the list in a format
  1538  suitable for adding to a config file to make aliases for all the
  1539  drives found and a combined drive.
  1540  
  1541      [My Drive]
  1542      type = alias
  1543      remote = drive,team_drive=0ABCDEF-01234567890,root_folder_id=:
  1544  
  1545      [Test Drive]
  1546      type = alias
  1547      remote = drive,team_drive=0ABCDEFabcdefghijkl,root_folder_id=:
  1548  
  1549      [AllDrives]
  1550      type = combine
  1551      upstreams = "My Drive=My Drive:" "Test Drive=Test Drive:"
  1552  
  1553  Adding this to the rclone config file will cause those team drives to
  1554  be accessible with the aliases shown. Any illegal characters will be
  1555  substituted with "_" and duplicate names will have numbers suffixed.
  1556  It will also add a remote called AllDrives which shows all the shared
  1557  drives combined into one directory tree.
  1558  
  1559  
  1560  ### untrash
  1561  
  1562  Untrash files and directories
  1563  
  1564      rclone backend untrash remote: [options] [<arguments>+]
  1565  
  1566  This command untrashes all the files and directories in the directory
  1567  passed in recursively.
  1568  
  1569  Usage:
  1570  
  1571  This takes an optional directory to trash which make this easier to
  1572  use via the API.
  1573  
  1574      rclone backend untrash drive:directory
  1575      rclone backend --interactive untrash drive:directory subdir
  1576  
  1577  Use the --interactive/-i or --dry-run flag to see what would be restored before restoring it.
  1578  
  1579  Result:
  1580  
  1581      {
  1582          "Untrashed": 17,
  1583          "Errors": 0
  1584      }
  1585  
  1586  
  1587  ### copyid
  1588  
  1589  Copy files by ID
  1590  
  1591      rclone backend copyid remote: [options] [<arguments>+]
  1592  
  1593  This command copies files by ID
  1594  
  1595  Usage:
  1596  
  1597      rclone backend copyid drive: ID path
  1598      rclone backend copyid drive: ID1 path1 ID2 path2
  1599  
  1600  It copies the drive file with ID given to the path (an rclone path which
  1601  will be passed internally to rclone copyto). The ID and path pairs can be
  1602  repeated.
  1603  
  1604  The path should end with a / to indicate copy the file as named to
  1605  this directory. If it doesn't end with a / then the last path
  1606  component will be used as the file name.
  1607  
  1608  If the destination is a drive backend then server-side copying will be
  1609  attempted if possible.
  1610  
  1611  Use the --interactive/-i or --dry-run flag to see what would be copied before copying.
  1612  
  1613  
  1614  ### exportformats
  1615  
  1616  Dump the export formats for debug purposes
  1617  
  1618      rclone backend exportformats remote: [options] [<arguments>+]
  1619  
  1620  ### importformats
  1621  
  1622  Dump the import formats for debug purposes
  1623  
  1624      rclone backend importformats remote: [options] [<arguments>+]
  1625  
  1626  {{< rem autogenerated options stop >}}
  1627  
  1628  ## Limitations
  1629  
  1630  Drive has quite a lot of rate limiting.  This causes rclone to be
  1631  limited to transferring about 2 files per second only.  Individual
  1632  files may be transferred much faster at 100s of MiB/s but lots of
  1633  small files can take a long time.
  1634  
  1635  Server side copies are also subject to a separate rate limit. If you
  1636  see User rate limit exceeded errors, wait at least 24 hours and retry.
  1637  You can disable server-side copies with `--disable copy` to download
  1638  and upload the files if you prefer.
  1639  
  1640  ### Limitations of Google Docs
  1641  
  1642  Google docs will appear as size -1 in `rclone ls`, `rclone ncdu` etc,
  1643  and as size 0 in anything which uses the VFS layer, e.g. `rclone mount`
  1644  and `rclone serve`. When calculating directory totals, e.g. in
  1645  `rclone size` and `rclone ncdu`, they will be counted in as empty
  1646  files.
  1647  
  1648  This is because rclone can't find out the size of the Google docs
  1649  without downloading them.
  1650  
  1651  Google docs will transfer correctly with `rclone sync`, `rclone copy`
  1652  etc as rclone knows to ignore the size when doing the transfer.
  1653  
  1654  However an unfortunate consequence of this is that you may not be able
  1655  to download Google docs using `rclone mount`. If it doesn't work you
  1656  will get a 0 sized file.  If you try again the doc may gain its
  1657  correct size and be downloadable. Whether it will work on not depends
  1658  on the application accessing the mount and the OS you are running -
  1659  experiment to find out if it does work for you!
  1660  
  1661  ### Duplicated files
  1662  
  1663  Sometimes, for no reason I've been able to track down, drive will
  1664  duplicate a file that rclone uploads.  Drive unlike all the other
  1665  remotes can have duplicated files.
  1666  
  1667  Duplicated files cause problems with the syncing and you will see
  1668  messages in the log about duplicates.
  1669  
  1670  Use `rclone dedupe` to fix duplicated files.
  1671  
  1672  Note that this isn't just a problem with rclone, even Google Photos on
  1673  Android duplicates files on drive sometimes.
  1674  
  1675  ### Rclone appears to be re-copying files it shouldn't
  1676  
  1677  The most likely cause of this is the duplicated file issue above - run
  1678  `rclone dedupe` and check your logs for duplicate object or directory
  1679  messages.
  1680  
  1681  This can also be caused by a delay/caching on google drive's end when
  1682  comparing directory listings. Specifically with team drives used in
  1683  combination with --fast-list. Files that were uploaded recently may
  1684  not appear on the directory list sent to rclone when using --fast-list.
  1685  
  1686  Waiting a moderate period of time between attempts (estimated to be
  1687  approximately 1 hour) and/or not using --fast-list both seem to be
  1688  effective in preventing the problem.
  1689  
  1690  ### SHA1 or SHA256 hashes may be missing
  1691  
  1692  All files have MD5 hashes, but a small fraction of files uploaded may
  1693  not have SHA1 or SHA256 hashes especially if they were uploaded before 2018.
  1694  
  1695  ## Making your own client_id
  1696  
  1697  When you use rclone with Google drive in its default configuration you
  1698  are using rclone's client_id.  This is shared between all the rclone
  1699  users.  There is a global rate limit on the number of queries per
  1700  second that each client_id can do set by Google.  rclone already has a
  1701  high quota and I will continue to make sure it is high enough by
  1702  contacting Google.
  1703  
  1704  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.
  1705  
  1706  Here is how to create your own Google Drive client ID for rclone:
  1707  
  1708  1. Log into the [Google API
  1709  Console](https://console.developers.google.com/) with your Google
  1710  account. It doesn't matter what Google account you use. (It need not
  1711  be the same account as the Google Drive you want to access)
  1712  
  1713  2. Select a project or create a new project.
  1714  
  1715  3. Under "ENABLE APIS AND SERVICES" search for "Drive", and enable the
  1716  "Google Drive API".
  1717  
  1718  4. Click "Credentials" in the left-side panel (not "Create
  1719  credentials", which opens the wizard).
  1720  
  1721  5. If you already configured an "Oauth Consent Screen", then skip
  1722  to the next step; if not, click on "CONFIGURE CONSENT SCREEN" button 
  1723  (near the top right corner of the right panel), then select "External"
  1724  and click on "CREATE"; on the next screen, enter an "Application name"
  1725  ("rclone" is OK); enter "User Support Email" (your own email is OK); 
  1726  enter "Developer Contact Email" (your own email is OK); then click on
  1727  "Save" (all other data is optional). You will also have to add [some scopes](https://developers.google.com/drive/api/guides/api-specific-auth),
  1728  including
  1729    - `https://www.googleapis.com/auth/docs`
  1730    - `https://www.googleapis.com/auth/drive` in order to be able to edit,
  1731  create and delete files with RClone. 
  1732    - `https://www.googleapis.com/auth/drive.metadata.readonly` which you may also want to add.
  1733    - If you want to add all at once, comma separated it would be `https://www.googleapis.com/auth/docs,https://www.googleapis.com/auth/drive,https://www.googleapis.com/auth/drive.metadata.readonly`.
  1734  6. After adding scopes, click
  1735  "Save and continue" to add test users. Be sure to add your own account to
  1736  the test users. Once you've added yourself as a test user and saved the
  1737  changes, click again on "Credentials" on the left panel to go back to
  1738  the "Credentials" screen.
  1739  
  1740     (PS: if you are a GSuite user, you could also select "Internal" instead
  1741  of "External" above, but this will restrict API use to Google Workspace 
  1742  users in your organisation). 
  1743  
  1744  7.  Click on the "+ CREATE CREDENTIALS" button at the top of the screen,
  1745  then select "OAuth client ID".
  1746  
  1747  8. Choose an application type of "Desktop app" and click "Create". (the default name is fine)
  1748  
  1749  9. It will show you a client ID and client secret. Make a note of these.
  1750     
  1751     (If you selected "External" at Step 5 continue to Step 9. 
  1752     If you chose "Internal" you don't need to publish and can skip straight to
  1753     Step 10 but your destination drive must be part of the same Google Workspace.)
  1754  
  1755  10. Go to "Oauth consent screen" and then click "PUBLISH APP" button and confirm.
  1756     You will also want to add yourself as a test user.
  1757  
  1758  11. Provide the noted client ID and client secret to rclone.
  1759  
  1760  Be aware that, due to the "enhanced security" recently introduced by
  1761  Google, you are theoretically expected to "submit your app for verification"
  1762  and then wait a few weeks(!) for their response; in practice, you can go right
  1763  ahead and use the client ID and client secret with rclone, the only issue will
  1764  be a very scary confirmation screen shown when you connect via your browser 
  1765  for rclone to be able to get its token-id (but as this only happens during 
  1766  the remote configuration, it's not such a big deal). Keeping the application in
  1767  "Testing" will work as well, but the limitation is that any grants will expire
  1768  after a week, which can be annoying to refresh constantly. If, for whatever
  1769  reason, a short grant time is not a problem, then keeping the application in
  1770  testing mode would also be sufficient.
  1771  
  1772  (Thanks to @balazer on github for these instructions.)
  1773  
  1774  Sometimes, creation of an OAuth consent in Google API Console fails due to an error message
  1775  “The request failed because changes to one of the field of the resource is not supported”.
  1776  As a convenient workaround, the necessary Google Drive API key can be created on the
  1777  [Python Quickstart](https://developers.google.com/drive/api/v3/quickstart/python) page.
  1778  Just push the Enable the Drive API button to receive the Client ID and Secret.
  1779  Note that it will automatically create a new project in the API Console.