github.com/xhghs/rclone@v1.51.1-0.20200430155106-e186a28cced8/docs/content/drive.md (about)

     1  ---
     2  title: "Google drive"
     3  description: "Rclone docs for Google drive"
     4  date: "2016-04-12"
     5  ---
     6  
     7  <i class="fab fa-google"></i> Google Drive
     8  -----------------------------------------
     9  
    10  Paths are specified as `drive:path`
    11  
    12  Drive paths may be as deep as required, eg `drive:directory/subdirectory`.
    13  
    14  The initial setup for drive involves getting a token from Google drive
    15  which you need to do in your browser.  `rclone config` walks you
    16  through it.
    17  
    18  Here is an example of how to make a remote called `remote`.  First run:
    19  
    20       rclone config
    21  
    22  This will guide you through an interactive setup process:
    23  
    24  ```
    25  No remotes found - make a new one
    26  n) New remote
    27  r) Rename remote
    28  c) Copy remote
    29  s) Set configuration password
    30  q) Quit config
    31  n/r/c/s/q> n
    32  name> remote
    33  Type of storage to configure.
    34  Choose a number from below, or type in your own value
    35  [snip]
    36  XX / Google Drive
    37     \ "drive"
    38  [snip]
    39  Storage> drive
    40  Google Application Client Id - leave blank normally.
    41  client_id>
    42  Google Application Client Secret - leave blank normally.
    43  client_secret>
    44  Scope that rclone should use when requesting access from drive.
    45  Choose a number from below, or type in your own value
    46   1 / Full access all files, excluding Application Data Folder.
    47     \ "drive"
    48   2 / Read-only access to file metadata and file contents.
    49     \ "drive.readonly"
    50     / Access to files created by rclone only.
    51   3 | These are visible in the drive website.
    52     | File authorization is revoked when the user deauthorizes the app.
    53     \ "drive.file"
    54     / Allows read and write access to the Application Data folder.
    55   4 | This is not visible in the drive website.
    56     \ "drive.appfolder"
    57     / Allows read-only access to file metadata but
    58   5 | does not allow any access to read or download file content.
    59     \ "drive.metadata.readonly"
    60  scope> 1
    61  ID of the root folder - leave blank normally.  Fill in to access "Computers" folders. (see docs).
    62  root_folder_id> 
    63  Service Account Credentials JSON file path - needed only if you want use SA instead of interactive login.
    64  service_account_file>
    65  Remote config
    66  Use auto config?
    67   * Say Y if not sure
    68   * Say N if you are working on a remote or headless machine or Y didn't work
    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 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  Note that rclone runs a webserver on your local machine to collect the
    96  token as returned from Google if you use auto config mode. This only
    97  runs from the moment it opens your browser to the moment you get back
    98  the verification code.  This is on `http://127.0.0.1:53682/` and this
    99  it may require you to unblock it temporarily if you are running a host
   100  firewall, or use manual mode.
   101  
   102  You can then use it like this,
   103  
   104  List directories in top level of your drive
   105  
   106      rclone lsd remote:
   107  
   108  List all the files in your drive
   109  
   110      rclone ls remote:
   111  
   112  To copy a local directory to a drive directory called backup
   113  
   114      rclone copy /home/source remote:backup
   115  
   116  ### Scopes ###
   117  
   118  Rclone allows you to select which scope you would like for rclone to
   119  use.  This changes what type of token is granted to rclone.  [The
   120  scopes are defined
   121  here.](https://developers.google.com/drive/v3/web/about-auth).
   122  
   123  The scope are
   124  
   125  #### drive ####
   126  
   127  This is the default scope and allows full access to all files, except
   128  for the Application Data Folder (see below).
   129  
   130  Choose this one if you aren't sure.
   131  
   132  #### drive.readonly ####
   133  
   134  This allows read only access to all files.  Files may be listed and
   135  downloaded but not uploaded, renamed or deleted.
   136  
   137  #### drive.file ####
   138  
   139  With this scope rclone can read/view/modify only those files and
   140  folders it creates.
   141  
   142  So if you uploaded files to drive via the web interface (or any other
   143  means) they will not be visible to rclone.
   144  
   145  This can be useful if you are using rclone to backup data and you want
   146  to be sure confidential data on your drive is not visible to rclone.
   147  
   148  Files created with this scope are visible in the web interface.
   149  
   150  #### drive.appfolder ####
   151  
   152  This gives rclone its own private area to store files.  Rclone will
   153  not be able to see any other files on your drive and you won't be able
   154  to see rclone's files from the web interface either.
   155  
   156  #### drive.metadata.readonly ####
   157  
   158  This allows read only access to file names only.  It does not allow
   159  rclone to download or upload data, or rename or delete files or
   160  directories.
   161  
   162  ### Root folder ID ###
   163  
   164  You can set the `root_folder_id` for rclone.  This is the directory
   165  (identified by its `Folder ID`) that rclone considers to be the root
   166  of your drive.
   167  
   168  Normally you will leave this blank and rclone will determine the
   169  correct root to use itself.
   170  
   171  However you can set this to restrict rclone to a specific folder
   172  hierarchy or to access data within the "Computers" tab on the drive
   173  web interface (where files from Google's Backup and Sync desktop
   174  program go).
   175  
   176  In order to do this you will have to find the `Folder ID` of the
   177  directory you wish rclone to display.  This will be the last segment
   178  of the URL when you open the relevant folder in the drive web
   179  interface.
   180  
   181  So if the folder you want rclone to use has a URL which looks like
   182  `https://drive.google.com/drive/folders/1XyfxxxxxxxxxxxxxxxxxxxxxxxxxKHCh`
   183  in the browser, then you use `1XyfxxxxxxxxxxxxxxxxxxxxxxxxxKHCh` as
   184  the `root_folder_id` in the config.
   185  
   186  **NB** folders under the "Computers" tab seem to be read only (drive
   187  gives a 500 error) when using rclone.
   188  
   189  There doesn't appear to be an API to discover the folder IDs of the
   190  "Computers" tab - please contact us if you know otherwise!
   191  
   192  Note also that rclone can't access any data under the "Backups" tab on
   193  the google drive web interface yet.
   194  
   195  ### Service Account support ###
   196  
   197  You can set up rclone with Google Drive in an unattended mode,
   198  i.e. not tied to a specific end-user Google account. This is useful
   199  when you want to synchronise files onto machines that don't have
   200  actively logged-in users, for example build machines.
   201  
   202  To use a Service Account instead of OAuth2 token flow, enter the path
   203  to your Service Account credentials at the `service_account_file`
   204  prompt during `rclone config` and rclone won't use the browser based
   205  authentication flow. If you'd rather stuff the contents of the
   206  credentials file into the rclone config file, you can set
   207  `service_account_credentials` with the actual contents of the file
   208  instead, or set the equivalent environment variable.
   209  
   210  #### Use case - Google Apps/G-suite account and individual Drive ####
   211  
   212  Let's say that you are the administrator of a Google Apps (old) or
   213  G-suite account.
   214  The goal is to store data on an individual's Drive account, who IS
   215  a member of the domain.
   216  We'll call the domain **example.com**, and the user
   217  **foo@example.com**.
   218  
   219  There's a few steps we need to go through to accomplish this:
   220  
   221  ##### 1. Create a service account for example.com #####
   222    - To create a service account and obtain its credentials, go to the
   223  [Google Developer Console](https://console.developers.google.com).
   224    - You must have a project - create one if you don't.
   225    - Then go to "IAM & admin" -> "Service Accounts".
   226    - Use the "Create Credentials" button. Fill in "Service account name"
   227  with something that identifies your client. "Role" can be empty.
   228    - Tick "Furnish a new private key" - select "Key type JSON".
   229    - Tick "Enable G Suite Domain-wide Delegation". This option makes
   230  "impersonation" possible, as documented here:
   231  [Delegating domain-wide authority to the service account](https://developers.google.com/identity/protocols/OAuth2ServiceAccount#delegatingauthority)
   232    - These credentials are what rclone will use for authentication.
   233  If you ever need to remove access, press the "Delete service
   234  account key" button.
   235  
   236  ##### 2. Allowing API access to example.com Google Drive #####
   237    - Go to example.com's admin console
   238    - Go into "Security" (or use the search bar)
   239    - Select "Show more" and then "Advanced settings"
   240    - Select "Manage API client access" in the "Authentication" section
   241    - In the "Client Name" field enter the service account's
   242  "Client ID" - this can be found in the Developer Console under
   243  "IAM & Admin" -> "Service Accounts", then "View Client ID" for
   244  the newly created service account.
   245  It is a ~21 character numerical string.
   246    - In the next field, "One or More API Scopes", enter
   247  `https://www.googleapis.com/auth/drive`
   248  to grant access to Google Drive specifically.
   249  
   250  ##### 3. Configure rclone, assuming a new install #####
   251  
   252  ```
   253  rclone config
   254  
   255  n/s/q> n         # New
   256  name>gdrive      # Gdrive is an example name
   257  Storage>         # Select the number shown for Google Drive
   258  client_id>       # Can be left blank
   259  client_secret>   # Can be left blank
   260  scope>           # Select your scope, 1 for example
   261  root_folder_id>  # Can be left blank
   262  service_account_file> /home/foo/myJSONfile.json # This is where the JSON file goes!
   263  y/n>             # Auto config, y
   264  
   265  ```
   266  
   267  ##### 4. Verify that it's working #####
   268    - `rclone -v --drive-impersonate foo@example.com lsf gdrive:backup`
   269    - The arguments do:
   270      - `-v` - verbose logging
   271      - `--drive-impersonate foo@example.com` - this is what does
   272  the magic, pretending to be user foo.
   273      - `lsf` - list files in a parsing friendly way
   274      - `gdrive:backup` - use the remote called gdrive, work in
   275  the folder named backup.
   276  
   277  ### Team drives ###
   278  
   279  If you want to configure the remote to point to a Google Team Drive
   280  then answer `y` to the question `Configure this as a team drive?`.
   281  
   282  This will fetch the list of Team Drives from google and allow you to
   283  configure which one you want to use.  You can also type in a team
   284  drive ID if you prefer.
   285  
   286  For example:
   287  
   288  ```
   289  Configure this as a team drive?
   290  y) Yes
   291  n) No
   292  y/n> y
   293  Fetching team drive list...
   294  Choose a number from below, or type in your own value
   295   1 / Rclone Test
   296     \ "xxxxxxxxxxxxxxxxxxxx"
   297   2 / Rclone Test 2
   298     \ "yyyyyyyyyyyyyyyyyyyy"
   299   3 / Rclone Test 3
   300     \ "zzzzzzzzzzzzzzzzzzzz"
   301  Enter a Team Drive ID> 1
   302  --------------------
   303  [remote]
   304  client_id =
   305  client_secret =
   306  token = {"AccessToken":"xxxx.x.xxxxx_xxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","RefreshToken":"1/xxxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxx","Expiry":"2014-03-16T13:57:58.955387075Z","Extra":null}
   307  team_drive = xxxxxxxxxxxxxxxxxxxx
   308  --------------------
   309  y) Yes this is OK
   310  e) Edit this remote
   311  d) Delete this remote
   312  y/e/d> y
   313  ```
   314  
   315  ### --fast-list ###
   316  
   317  This remote supports `--fast-list` which allows you to use fewer
   318  transactions in exchange for more memory. See the [rclone
   319  docs](/docs/#fast-list) for more details.
   320  
   321  It does this by combining multiple `list` calls into a single API request.
   322  
   323  This works by combining many `'%s' in parents` filters into one expression.
   324  To list the contents of directories a, b and c, the following requests will be send by the regular `List` function:
   325  ```
   326  trashed=false and 'a' in parents
   327  trashed=false and 'b' in parents
   328  trashed=false and 'c' in parents
   329  ```
   330  These can now be combined into a single request:
   331  ```
   332  trashed=false and ('a' in parents or 'b' in parents or 'c' in parents)
   333  ```
   334  
   335  The implementation of `ListR` will put up to 50 `parents` filters into one request.
   336  It will  use the `--checkers` value to specify the number of requests to run in parallel.
   337  
   338  In tests, these batch requests were up to 20x faster than the regular method.
   339  Running the following command against different sized folders gives:
   340  ```
   341  rclone lsjson -vv -R --checkers=6 gdrive:folder
   342  ```
   343  
   344  small folder (220 directories, 700 files):
   345  
   346  - without `--fast-list`: 38s
   347  - with `--fast-list`: 10s
   348  
   349  large folder (10600 directories, 39000 files):
   350  
   351  - without `--fast-list`: 22:05 min
   352  - with `--fast-list`: 58s
   353  
   354  ### Modified time ###
   355  
   356  Google drive stores modification times accurate to 1 ms.
   357  
   358  #### Restricted filename characters
   359  
   360  Only Invalid UTF-8 bytes will be [replaced](/overview/#invalid-utf8),
   361  as they can't be used in JSON strings.
   362  
   363  In contrast to other backends, `/` can also be used in names and `.`
   364  or `..` are valid names.
   365  
   366  ### Revisions ###
   367  
   368  Google drive stores revisions of files.  When you upload a change to
   369  an existing file to google drive using rclone it will create a new
   370  revision of that file.
   371  
   372  Revisions follow the standard google policy which at time of writing
   373  was
   374  
   375    * They are deleted after 30 days or 100 revisions (whatever comes first).
   376    * They do not count towards a user storage quota.
   377  
   378  ### Deleting files ###
   379  
   380  By default rclone will send all files to the trash when deleting
   381  files.  If deleting them permanently is required then use the
   382  `--drive-use-trash=false` flag, or set the equivalent environment
   383  variable.
   384  
   385  ### Emptying trash ###
   386  
   387  If you wish to empty your trash you can use the `rclone cleanup remote:`
   388  command which will permanently delete all your trashed files. This command
   389  does not take any path arguments.
   390  
   391  Note that Google Drive takes some time (minutes to days) to empty the
   392  trash even though the command returns within a few seconds.  No output
   393  is echoed, so there will be no confirmation even using -v or -vv.
   394  
   395  ### Quota information ###
   396  
   397  To view your current quota you can use the `rclone about remote:`
   398  command which will display your usage limit (quota), the usage in Google
   399  Drive, the size of all files in the Trash and the space used by other
   400  Google services such as Gmail. This command does not take any path
   401  arguments.
   402  
   403  #### Import/Export of google documents ####
   404  
   405  Google documents can be exported from and uploaded to Google Drive.
   406  
   407  When rclone downloads a Google doc it chooses a format to download
   408  depending upon the `--drive-export-formats` setting.
   409  By default the export formats are `docx,xlsx,pptx,svg` which are a
   410  sensible default for an editable document.
   411  
   412  When choosing a format, rclone runs down the list provided in order
   413  and chooses the first file format the doc can be exported as from the
   414  list. If the file can't be exported to a format on the formats list,
   415  then rclone will choose a format from the default list.
   416  
   417  If you prefer an archive copy then you might use `--drive-export-formats
   418  pdf`, or if you prefer openoffice/libreoffice formats you might use
   419  `--drive-export-formats ods,odt,odp`.
   420  
   421  Note that rclone adds the extension to the google doc, so if it is
   422  called `My Spreadsheet` on google docs, it will be exported as `My
   423  Spreadsheet.xlsx` or `My Spreadsheet.pdf` etc.
   424  
   425  When importing files into Google Drive, rclone will convert all
   426  files with an extension in `--drive-import-formats` to their
   427  associated document type.
   428  rclone will not convert any files by default, since the conversion
   429  is lossy process.
   430  
   431  The conversion must result in a file with the same extension when
   432  the `--drive-export-formats` rules are applied to the uploaded document.
   433  
   434  Here are some examples for allowed and prohibited conversions.
   435  
   436  | export-formats | import-formats | Upload Ext | Document Ext | Allowed |
   437  | -------------- | -------------- | ---------- | ------------ | ------- |
   438  | odt | odt | odt | odt | Yes |
   439  | odt | docx,odt | odt | odt | Yes |
   440  |  | docx | docx | docx | Yes |
   441  |  | odt | odt | docx | No |
   442  | odt,docx | docx,odt | docx | odt | No |
   443  | docx,odt | docx,odt | docx | docx | Yes |
   444  | docx,odt | docx,odt | odt | docx | No |
   445  
   446  This limitation can be disabled by specifying `--drive-allow-import-name-change`.
   447  When using this flag, rclone can convert multiple files types resulting
   448  in the same document type at once, eg with `--drive-import-formats docx,odt,txt`,
   449  all files having these extension would result in a document represented as a docx file.
   450  This brings the additional risk of overwriting a document, if multiple files
   451  have the same stem. Many rclone operations will not handle this name change
   452  in any way. They assume an equal name when copying files and might copy the
   453  file again or delete them when the name changes. 
   454  
   455  Here are the possible export extensions with their corresponding mime types.
   456  Most of these can also be used for importing, but there more that are not
   457  listed here. Some of these additional ones might only be available when
   458  the operating system provides the correct MIME type entries.
   459  
   460  This list can be changed by Google Drive at any time and might not
   461  represent the currently available conversions.
   462  
   463  | Extension | Mime Type | Description |
   464  | --------- |-----------| ------------|
   465  | csv  | text/csv | Standard CSV format for Spreadsheets |
   466  | docx | application/vnd.openxmlformats-officedocument.wordprocessingml.document | Microsoft Office Document |
   467  | epub | application/epub+zip | E-book format |
   468  | html | text/html | An HTML Document |
   469  | jpg  | image/jpeg | A JPEG Image File |
   470  | json | application/vnd.google-apps.script+json | JSON Text Format |
   471  | odp  | application/vnd.oasis.opendocument.presentation | Openoffice Presentation |
   472  | ods  | application/vnd.oasis.opendocument.spreadsheet | Openoffice Spreadsheet |
   473  | ods  | application/x-vnd.oasis.opendocument.spreadsheet | Openoffice Spreadsheet |
   474  | odt  | application/vnd.oasis.opendocument.text | Openoffice Document |
   475  | pdf  | application/pdf | Adobe PDF Format |
   476  | png  | image/png | PNG Image Format|
   477  | pptx | application/vnd.openxmlformats-officedocument.presentationml.presentation | Microsoft Office Powerpoint |
   478  | rtf  | application/rtf | Rich Text Format |
   479  | svg  | image/svg+xml | Scalable Vector Graphics Format |
   480  | tsv  | text/tab-separated-values | Standard TSV format for spreadsheets |
   481  | txt  | text/plain | Plain Text |
   482  | xlsx | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | Microsoft Office Spreadsheet |
   483  | zip  | application/zip | A ZIP file of HTML, Images CSS |
   484  
   485  Google documents can also be exported as link files. These files will
   486  open a browser window for the Google Docs website of that document
   487  when opened. The link file extension has to be specified as a
   488  `--drive-export-formats` parameter. They will match all available
   489  Google Documents.
   490  
   491  | Extension | Description | OS Support |
   492  | --------- | ----------- | ---------- |
   493  | desktop | freedesktop.org specified desktop entry | Linux |
   494  | link.html | An HTML Document with a redirect | All |
   495  | url | INI style link file | macOS, Windows |
   496  | webloc | macOS specific XML format | macOS |
   497  
   498  <!--- autogenerated options start - DO NOT EDIT, instead edit fs.RegInfo in backend/drive/drive.go then run make backenddocs -->
   499  ### Standard Options
   500  
   501  Here are the standard options specific to drive (Google Drive).
   502  
   503  #### --drive-client-id
   504  
   505  Google Application Client Id
   506  Setting your own is recommended.
   507  See https://rclone.org/drive/#making-your-own-client-id for how to create your own.
   508  If you leave this blank, it will use an internal key which is low performance.
   509  
   510  - Config:      client_id
   511  - Env Var:     RCLONE_DRIVE_CLIENT_ID
   512  - Type:        string
   513  - Default:     ""
   514  
   515  #### --drive-client-secret
   516  
   517  Google Application Client Secret
   518  Setting your own is recommended.
   519  
   520  - Config:      client_secret
   521  - Env Var:     RCLONE_DRIVE_CLIENT_SECRET
   522  - Type:        string
   523  - Default:     ""
   524  
   525  #### --drive-scope
   526  
   527  Scope that rclone should use when requesting access from drive.
   528  
   529  - Config:      scope
   530  - Env Var:     RCLONE_DRIVE_SCOPE
   531  - Type:        string
   532  - Default:     ""
   533  - Examples:
   534      - "drive"
   535          - Full access all files, excluding Application Data Folder.
   536      - "drive.readonly"
   537          - Read-only access to file metadata and file contents.
   538      - "drive.file"
   539          - Access to files created by rclone only.
   540          - These are visible in the drive website.
   541          - File authorization is revoked when the user deauthorizes the app.
   542      - "drive.appfolder"
   543          - Allows read and write access to the Application Data folder.
   544          - This is not visible in the drive website.
   545      - "drive.metadata.readonly"
   546          - Allows read-only access to file metadata but
   547          - does not allow any access to read or download file content.
   548  
   549  #### --drive-root-folder-id
   550  
   551  ID of the root folder
   552  Leave blank normally.
   553  
   554  Fill in to access "Computers" folders (see docs), or for rclone to use
   555  a non root folder as its starting point.
   556  
   557  Note that if this is blank, the first time rclone runs it will fill it
   558  in with the ID of the root folder.
   559  
   560  
   561  - Config:      root_folder_id
   562  - Env Var:     RCLONE_DRIVE_ROOT_FOLDER_ID
   563  - Type:        string
   564  - Default:     ""
   565  
   566  #### --drive-service-account-file
   567  
   568  Service Account Credentials JSON file path 
   569  Leave blank normally.
   570  Needed only if you want use SA instead of interactive login.
   571  
   572  - Config:      service_account_file
   573  - Env Var:     RCLONE_DRIVE_SERVICE_ACCOUNT_FILE
   574  - Type:        string
   575  - Default:     ""
   576  
   577  ### Advanced Options
   578  
   579  Here are the advanced options specific to drive (Google Drive).
   580  
   581  #### --drive-service-account-credentials
   582  
   583  Service Account Credentials JSON blob
   584  Leave blank normally.
   585  Needed only if you want use SA instead of interactive login.
   586  
   587  - Config:      service_account_credentials
   588  - Env Var:     RCLONE_DRIVE_SERVICE_ACCOUNT_CREDENTIALS
   589  - Type:        string
   590  - Default:     ""
   591  
   592  #### --drive-team-drive
   593  
   594  ID of the Team Drive
   595  
   596  - Config:      team_drive
   597  - Env Var:     RCLONE_DRIVE_TEAM_DRIVE
   598  - Type:        string
   599  - Default:     ""
   600  
   601  #### --drive-auth-owner-only
   602  
   603  Only consider files owned by the authenticated user.
   604  
   605  - Config:      auth_owner_only
   606  - Env Var:     RCLONE_DRIVE_AUTH_OWNER_ONLY
   607  - Type:        bool
   608  - Default:     false
   609  
   610  #### --drive-use-trash
   611  
   612  Send files to the trash instead of deleting permanently.
   613  Defaults to true, namely sending files to the trash.
   614  Use `--drive-use-trash=false` to delete files permanently instead.
   615  
   616  - Config:      use_trash
   617  - Env Var:     RCLONE_DRIVE_USE_TRASH
   618  - Type:        bool
   619  - Default:     true
   620  
   621  #### --drive-skip-gdocs
   622  
   623  Skip google documents in all listings.
   624  If given, gdocs practically become invisible to rclone.
   625  
   626  - Config:      skip_gdocs
   627  - Env Var:     RCLONE_DRIVE_SKIP_GDOCS
   628  - Type:        bool
   629  - Default:     false
   630  
   631  #### --drive-skip-checksum-gphotos
   632  
   633  Skip MD5 checksum on Google photos and videos only.
   634  
   635  Use this if you get checksum errors when transferring Google photos or
   636  videos.
   637  
   638  Setting this flag will cause Google photos and videos to return a
   639  blank MD5 checksum.
   640  
   641  Google photos are identifed by being in the "photos" space.
   642  
   643  Corrupted checksums are caused by Google modifying the image/video but
   644  not updating the checksum.
   645  
   646  - Config:      skip_checksum_gphotos
   647  - Env Var:     RCLONE_DRIVE_SKIP_CHECKSUM_GPHOTOS
   648  - Type:        bool
   649  - Default:     false
   650  
   651  #### --drive-shared-with-me
   652  
   653  Only show files that are shared with me.
   654  
   655  Instructs rclone to operate on your "Shared with me" folder (where
   656  Google Drive lets you access the files and folders others have shared
   657  with you).
   658  
   659  This works both with the "list" (lsd, lsl, etc) and the "copy"
   660  commands (copy, sync, etc), and with all other commands too.
   661  
   662  - Config:      shared_with_me
   663  - Env Var:     RCLONE_DRIVE_SHARED_WITH_ME
   664  - Type:        bool
   665  - Default:     false
   666  
   667  #### --drive-trashed-only
   668  
   669  Only show files that are in the trash.
   670  This will show trashed files in their original directory structure.
   671  
   672  - Config:      trashed_only
   673  - Env Var:     RCLONE_DRIVE_TRASHED_ONLY
   674  - Type:        bool
   675  - Default:     false
   676  
   677  #### --drive-formats
   678  
   679  Deprecated: see export_formats
   680  
   681  - Config:      formats
   682  - Env Var:     RCLONE_DRIVE_FORMATS
   683  - Type:        string
   684  - Default:     ""
   685  
   686  #### --drive-export-formats
   687  
   688  Comma separated list of preferred formats for downloading Google docs.
   689  
   690  - Config:      export_formats
   691  - Env Var:     RCLONE_DRIVE_EXPORT_FORMATS
   692  - Type:        string
   693  - Default:     "docx,xlsx,pptx,svg"
   694  
   695  #### --drive-import-formats
   696  
   697  Comma separated list of preferred formats for uploading Google docs.
   698  
   699  - Config:      import_formats
   700  - Env Var:     RCLONE_DRIVE_IMPORT_FORMATS
   701  - Type:        string
   702  - Default:     ""
   703  
   704  #### --drive-allow-import-name-change
   705  
   706  Allow the filetype to change when uploading Google docs (e.g. file.doc to file.docx). This will confuse sync and reupload every time.
   707  
   708  - Config:      allow_import_name_change
   709  - Env Var:     RCLONE_DRIVE_ALLOW_IMPORT_NAME_CHANGE
   710  - Type:        bool
   711  - Default:     false
   712  
   713  #### --drive-use-created-date
   714  
   715  Use file created date instead of modified date.,
   716  
   717  Useful when downloading data and you want the creation date used in
   718  place of the last modified date.
   719  
   720  **WARNING**: This flag may have some unexpected consequences.
   721  
   722  When uploading to your drive all files will be overwritten unless they
   723  haven't been modified since their creation. And the inverse will occur
   724  while downloading.  This side effect can be avoided by using the
   725  "--checksum" flag.
   726  
   727  This feature was implemented to retain photos capture date as recorded
   728  by google photos. You will first need to check the "Create a Google
   729  Photos folder" option in your google drive settings. You can then copy
   730  or move the photos locally and use the date the image was taken
   731  (created) set as the modification date.
   732  
   733  - Config:      use_created_date
   734  - Env Var:     RCLONE_DRIVE_USE_CREATED_DATE
   735  - Type:        bool
   736  - Default:     false
   737  
   738  #### --drive-use-shared-date
   739  
   740  Use date file was shared instead of modified date.
   741  
   742  Note that, as with "--drive-use-created-date", this flag may have
   743  unexpected consequences when uploading/downloading files.
   744  
   745  If both this flag and "--drive-use-created-date" are set, the created
   746  date is used.
   747  
   748  - Config:      use_shared_date
   749  - Env Var:     RCLONE_DRIVE_USE_SHARED_DATE
   750  - Type:        bool
   751  - Default:     false
   752  
   753  #### --drive-list-chunk
   754  
   755  Size of listing chunk 100-1000. 0 to disable.
   756  
   757  - Config:      list_chunk
   758  - Env Var:     RCLONE_DRIVE_LIST_CHUNK
   759  - Type:        int
   760  - Default:     1000
   761  
   762  #### --drive-impersonate
   763  
   764  Impersonate this user when using a service account.
   765  
   766  - Config:      impersonate
   767  - Env Var:     RCLONE_DRIVE_IMPERSONATE
   768  - Type:        string
   769  - Default:     ""
   770  
   771  #### --drive-alternate-export
   772  
   773  Use alternate export URLs for google documents export.,
   774  
   775  If this option is set this instructs rclone to use an alternate set of
   776  export URLs for drive documents.  Users have reported that the
   777  official export URLs can't export large documents, whereas these
   778  unofficial ones can.
   779  
   780  See rclone issue [#2243](https://github.com/rclone/rclone/issues/2243) for background,
   781  [this google drive issue](https://issuetracker.google.com/issues/36761333) and
   782  [this helpful post](https://www.labnol.org/internet/direct-links-for-google-drive/28356/).
   783  
   784  - Config:      alternate_export
   785  - Env Var:     RCLONE_DRIVE_ALTERNATE_EXPORT
   786  - Type:        bool
   787  - Default:     false
   788  
   789  #### --drive-upload-cutoff
   790  
   791  Cutoff for switching to chunked upload
   792  
   793  - Config:      upload_cutoff
   794  - Env Var:     RCLONE_DRIVE_UPLOAD_CUTOFF
   795  - Type:        SizeSuffix
   796  - Default:     8M
   797  
   798  #### --drive-chunk-size
   799  
   800  Upload chunk size. Must a power of 2 >= 256k.
   801  
   802  Making this larger will improve performance, but note that each chunk
   803  is buffered in memory one per transfer.
   804  
   805  Reducing this will reduce memory usage but decrease performance.
   806  
   807  - Config:      chunk_size
   808  - Env Var:     RCLONE_DRIVE_CHUNK_SIZE
   809  - Type:        SizeSuffix
   810  - Default:     8M
   811  
   812  #### --drive-acknowledge-abuse
   813  
   814  Set to allow files which return cannotDownloadAbusiveFile to be downloaded.
   815  
   816  If downloading a file returns the error "This file has been identified
   817  as malware or spam and cannot be downloaded" with the error code
   818  "cannotDownloadAbusiveFile" then supply this flag to rclone to
   819  indicate you acknowledge the risks of downloading the file and rclone
   820  will download it anyway.
   821  
   822  - Config:      acknowledge_abuse
   823  - Env Var:     RCLONE_DRIVE_ACKNOWLEDGE_ABUSE
   824  - Type:        bool
   825  - Default:     false
   826  
   827  #### --drive-keep-revision-forever
   828  
   829  Keep new head revision of each file forever.
   830  
   831  - Config:      keep_revision_forever
   832  - Env Var:     RCLONE_DRIVE_KEEP_REVISION_FOREVER
   833  - Type:        bool
   834  - Default:     false
   835  
   836  #### --drive-size-as-quota
   837  
   838  Show sizes as storage quota usage, not actual size.
   839  
   840  Show the size of a file as the the storage quota used. This is the
   841  current version plus any older versions that have been set to keep
   842  forever.
   843  
   844  **WARNING**: This flag may have some unexpected consequences.
   845  
   846  It is not recommended to set this flag in your config - the
   847  recommended usage is using the flag form --drive-size-as-quota when
   848  doing rclone ls/lsl/lsf/lsjson/etc only.
   849  
   850  If you do use this flag for syncing (not recommended) then you will
   851  need to use --ignore size also.
   852  
   853  - Config:      size_as_quota
   854  - Env Var:     RCLONE_DRIVE_SIZE_AS_QUOTA
   855  - Type:        bool
   856  - Default:     false
   857  
   858  #### --drive-v2-download-min-size
   859  
   860  If Object's are greater, use drive v2 API to download.
   861  
   862  - Config:      v2_download_min_size
   863  - Env Var:     RCLONE_DRIVE_V2_DOWNLOAD_MIN_SIZE
   864  - Type:        SizeSuffix
   865  - Default:     off
   866  
   867  #### --drive-pacer-min-sleep
   868  
   869  Minimum time to sleep between API calls.
   870  
   871  - Config:      pacer_min_sleep
   872  - Env Var:     RCLONE_DRIVE_PACER_MIN_SLEEP
   873  - Type:        Duration
   874  - Default:     100ms
   875  
   876  #### --drive-pacer-burst
   877  
   878  Number of API calls to allow without sleeping.
   879  
   880  - Config:      pacer_burst
   881  - Env Var:     RCLONE_DRIVE_PACER_BURST
   882  - Type:        int
   883  - Default:     100
   884  
   885  #### --drive-server-side-across-configs
   886  
   887  Allow server side operations (eg copy) to work across different drive configs.
   888  
   889  This can be useful if you wish to do a server side copy between two
   890  different Google drives.  Note that this isn't enabled by default
   891  because it isn't easy to tell if it will work between any two
   892  configurations.
   893  
   894  - Config:      server_side_across_configs
   895  - Env Var:     RCLONE_DRIVE_SERVER_SIDE_ACROSS_CONFIGS
   896  - Type:        bool
   897  - Default:     false
   898  
   899  #### --drive-disable-http2
   900  
   901  Disable drive using http2
   902  
   903  There is currently an unsolved issue with the google drive backend and
   904  HTTP/2.  HTTP/2 is therefore disabled by default for the drive backend
   905  but can be re-enabled here.  When the issue is solved this flag will
   906  be removed.
   907  
   908  See: https://github.com/rclone/rclone/issues/3631
   909  
   910  
   911  
   912  - Config:      disable_http2
   913  - Env Var:     RCLONE_DRIVE_DISABLE_HTTP2
   914  - Type:        bool
   915  - Default:     true
   916  
   917  #### --drive-stop-on-upload-limit
   918  
   919  Make upload limit errors be fatal
   920  
   921  At the time of writing it is only possible to upload 750GB of data to
   922  Google Drive a day (this is an undocumented limit). When this limit is
   923  reached Google Drive produces a slightly different error message. When
   924  this flag is set it causes these errors to be fatal.  These will stop
   925  the in-progress sync.
   926  
   927  Note that this detection is relying on error message strings which
   928  Google don't document so it may break in the future.
   929  
   930  See: https://github.com/rclone/rclone/issues/3857
   931  
   932  
   933  - Config:      stop_on_upload_limit
   934  - Env Var:     RCLONE_DRIVE_STOP_ON_UPLOAD_LIMIT
   935  - Type:        bool
   936  - Default:     false
   937  
   938  #### --drive-encoding
   939  
   940  This sets the encoding for the backend.
   941  
   942  See: the [encoding section in the overview](/overview/#encoding) for more info.
   943  
   944  - Config:      encoding
   945  - Env Var:     RCLONE_DRIVE_ENCODING
   946  - Type:        MultiEncoder
   947  - Default:     InvalidUtf8
   948  
   949  <!--- autogenerated options stop -->
   950  
   951  ### Limitations ###
   952  
   953  Drive has quite a lot of rate limiting.  This causes rclone to be
   954  limited to transferring about 2 files per second only.  Individual
   955  files may be transferred much faster at 100s of MBytes/s but lots of
   956  small files can take a long time.
   957  
   958  Server side copies are also subject to a separate rate limit. If you
   959  see User rate limit exceeded errors, wait at least 24 hours and retry.
   960  You can disable server side copies with `--disable copy` to download
   961  and upload the files if you prefer.
   962  
   963  #### Limitations of Google Docs ####
   964  
   965  Google docs will appear as size -1 in `rclone ls` and as size 0 in
   966  anything which uses the VFS layer, eg `rclone mount`, `rclone serve`.
   967  
   968  This is because rclone can't find out the size of the Google docs
   969  without downloading them.
   970  
   971  Google docs will transfer correctly with `rclone sync`, `rclone copy`
   972  etc as rclone knows to ignore the size when doing the transfer.
   973  
   974  However an unfortunate consequence of this is that you may not be able
   975  to download Google docs using `rclone mount`. If it doesn't work you
   976  will get a 0 sized file.  If you try again the doc may gain its
   977  correct size and be downloadable. Whther it will work on not depends
   978  on the application accessing the mount and the OS you are running -
   979  experiment to find out if it does work for you!
   980  
   981  ### Duplicated files ###
   982  
   983  Sometimes, for no reason I've been able to track down, drive will
   984  duplicate a file that rclone uploads.  Drive unlike all the other
   985  remotes can have duplicated files.
   986  
   987  Duplicated files cause problems with the syncing and you will see
   988  messages in the log about duplicates.
   989  
   990  Use `rclone dedupe` to fix duplicated files.
   991  
   992  Note that this isn't just a problem with rclone, even Google Photos on
   993  Android duplicates files on drive sometimes.
   994  
   995  ### Rclone appears to be re-copying files it shouldn't ###
   996  
   997  The most likely cause of this is the duplicated file issue above - run
   998  `rclone dedupe` and check your logs for duplicate object or directory
   999  messages.
  1000  
  1001  This can also be caused by a delay/caching on google drive's end when
  1002  comparing directory listings. Specifically with team drives used in
  1003  combination with --fast-list. Files that were uploaded recently may
  1004  not appear on the directory list sent to rclone when using --fast-list.
  1005  
  1006  Waiting a moderate period of time between attempts (estimated to be
  1007  approximately 1 hour) and/or not using --fast-list both seem to be
  1008  effective in preventing the problem.
  1009  
  1010  ### Making your own client_id ###
  1011  
  1012  When you use rclone with Google drive in its default configuration you
  1013  are using rclone's client_id.  This is shared between all the rclone
  1014  users.  There is a global rate limit on the number of queries per
  1015  second that each client_id can do set by Google.  rclone already has a
  1016  high quota and I will continue to make sure it is high enough by
  1017  contacting Google.
  1018  
  1019  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.
  1020  
  1021  Here is how to create your own Google Drive client ID for rclone:
  1022  
  1023  1. Log into the [Google API
  1024  Console](https://console.developers.google.com/) with your Google
  1025  account. It doesn't matter what Google account you use. (It need not
  1026  be the same account as the Google Drive you want to access)
  1027  
  1028  2. Select a project or create a new project.
  1029  
  1030  3. Under "ENABLE APIS AND SERVICES" search for "Drive", and enable the
  1031  "Google Drive API".
  1032  
  1033  4. Click "Credentials" in the left-side panel (not "Create
  1034  credentials", which opens the wizard), then "Create credentials", then
  1035  "OAuth client ID".  It will prompt you to set the OAuth consent screen
  1036  product name, if you haven't set one already.
  1037  
  1038  5. Choose an application type of "other", and click "Create". (the
  1039  default name is fine)
  1040  
  1041  6. It will show you a client ID and client secret.  Use these values
  1042  in rclone config to add a new remote or edit an existing remote.
  1043  
  1044  (Thanks to @balazer on github for these instructions.)