2014-03-28 22:34:13 +00:00
|
|
|
---
|
|
|
|
title: "Google drive"
|
|
|
|
description: "Rclone docs for Google drive"
|
2016-04-12 20:33:55 +00:00
|
|
|
date: "2016-04-12"
|
2014-03-28 22:34:13 +00:00
|
|
|
---
|
|
|
|
|
2014-07-17 19:03:11 +00:00
|
|
|
<i class="fa fa-google"></i> Google Drive
|
|
|
|
-----------------------------------------
|
|
|
|
|
2014-03-28 22:34:13 +00:00
|
|
|
Paths are specified as `drive:path`
|
|
|
|
|
2014-07-17 19:03:11 +00:00
|
|
|
Drive paths may be as deep as required, eg `drive:directory/subdirectory`.
|
2014-03-28 22:34:13 +00:00
|
|
|
|
|
|
|
The initial setup for drive involves getting a token from Google drive
|
|
|
|
which you need to do in your browser. `rclone config` walks you
|
|
|
|
through it.
|
|
|
|
|
|
|
|
Here is an example of how to make a remote called `remote`. First run:
|
|
|
|
|
|
|
|
rclone config
|
|
|
|
|
|
|
|
This will guide you through an interactive setup process:
|
|
|
|
|
|
|
|
```
|
|
|
|
n) New remote
|
|
|
|
d) Delete remote
|
|
|
|
q) Quit config
|
|
|
|
e/n/d/q> n
|
|
|
|
name> remote
|
2016-02-21 13:39:04 +00:00
|
|
|
Type of storage to configure.
|
|
|
|
Choose a number from below, or type in your own value
|
2016-07-11 11:42:44 +00:00
|
|
|
1 / Amazon Drive
|
2016-02-21 13:39:04 +00:00
|
|
|
\ "amazon cloud drive"
|
|
|
|
2 / Amazon S3 (also Dreamhost, Ceph)
|
|
|
|
\ "s3"
|
|
|
|
3 / Backblaze B2
|
|
|
|
\ "b2"
|
|
|
|
4 / Dropbox
|
|
|
|
\ "dropbox"
|
|
|
|
5 / Google Cloud Storage (this is not Google Drive)
|
|
|
|
\ "google cloud storage"
|
|
|
|
6 / Google Drive
|
|
|
|
\ "drive"
|
|
|
|
7 / Hubic
|
|
|
|
\ "hubic"
|
|
|
|
8 / Local Disk
|
|
|
|
\ "local"
|
|
|
|
9 / Microsoft OneDrive
|
|
|
|
\ "onedrive"
|
|
|
|
10 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
|
|
|
|
\ "swift"
|
|
|
|
11 / Yandex Disk
|
|
|
|
\ "yandex"
|
|
|
|
Storage> 6
|
2015-10-03 13:23:12 +00:00
|
|
|
Google Application Client Id - leave blank normally.
|
2014-03-28 22:34:13 +00:00
|
|
|
client_id>
|
2015-10-03 13:23:12 +00:00
|
|
|
Google Application Client Secret - leave blank normally.
|
2014-03-28 22:34:13 +00:00
|
|
|
client_secret>
|
|
|
|
Remote config
|
2015-09-12 13:17:39 +00:00
|
|
|
Use auto config?
|
|
|
|
* Say Y if not sure
|
2015-09-30 14:04:02 +00:00
|
|
|
* Say N if you are working on a remote or headless machine or Y didn't work
|
2015-09-12 13:17:39 +00:00
|
|
|
y) Yes
|
|
|
|
n) No
|
|
|
|
y/n> y
|
|
|
|
If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth
|
|
|
|
Log in and authorize rclone for access
|
|
|
|
Waiting for code...
|
|
|
|
Got code
|
2014-03-28 22:34:13 +00:00
|
|
|
--------------------
|
|
|
|
[remote]
|
|
|
|
client_id =
|
|
|
|
client_secret =
|
|
|
|
token = {"AccessToken":"xxxx.x.xxxxx_xxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","RefreshToken":"1/xxxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxx","Expiry":"2014-03-16T13:57:58.955387075Z","Extra":null}
|
|
|
|
--------------------
|
|
|
|
y) Yes this is OK
|
|
|
|
e) Edit this remote
|
|
|
|
d) Delete this remote
|
|
|
|
y/e/d> y
|
|
|
|
```
|
|
|
|
|
2015-09-12 13:17:39 +00:00
|
|
|
Note that rclone runs a webserver on your local machine to collect the
|
|
|
|
token as returned from Google if you use auto config mode. This only
|
|
|
|
runs from the moment it opens your browser to the moment you get back
|
|
|
|
the verification code. This is on `http://127.0.0.1:53682/` and this
|
|
|
|
it may require you to unblock it temporarily if you are running a host
|
|
|
|
firewall, or use manual mode.
|
|
|
|
|
2014-03-28 22:34:13 +00:00
|
|
|
You can then use it like this,
|
|
|
|
|
|
|
|
List directories in top level of your drive
|
|
|
|
|
|
|
|
rclone lsd remote:
|
|
|
|
|
|
|
|
List all the files in your drive
|
|
|
|
|
|
|
|
rclone ls remote:
|
|
|
|
|
|
|
|
To copy a local directory to a drive directory called backup
|
|
|
|
|
|
|
|
rclone copy /home/source remote:backup
|
|
|
|
|
2015-06-06 09:05:21 +00:00
|
|
|
### Modified time ###
|
2014-03-28 22:34:13 +00:00
|
|
|
|
|
|
|
Google drive stores modification times accurate to 1 ms.
|
2015-05-10 11:17:24 +00:00
|
|
|
|
2015-06-06 09:05:21 +00:00
|
|
|
### Revisions ###
|
2015-05-10 11:17:24 +00:00
|
|
|
|
|
|
|
Google drive stores revisions of files. When you upload a change to
|
|
|
|
an existing file to google drive using rclone it will create a new
|
|
|
|
revision of that file.
|
|
|
|
|
|
|
|
Revisions follow the standard google policy which at time of writing
|
|
|
|
was
|
|
|
|
|
|
|
|
* They are deleted after 30 days or 100 revisions (whatever comes first).
|
|
|
|
* They do not count towards a user storage quota.
|
2015-05-21 17:39:46 +00:00
|
|
|
|
2015-08-16 13:49:58 +00:00
|
|
|
### Deleting files ###
|
|
|
|
|
|
|
|
By default rclone will delete files permanently when requested. If
|
|
|
|
sending them to the trash is required instead then use the
|
|
|
|
`--drive-use-trash` flag.
|
|
|
|
|
2015-11-14 11:38:35 +00:00
|
|
|
### Specific options ###
|
|
|
|
|
|
|
|
Here are the command line options specific to this cloud storage
|
|
|
|
system.
|
|
|
|
|
|
|
|
#### --drive-chunk-size=SIZE ####
|
|
|
|
|
2016-04-12 20:33:55 +00:00
|
|
|
Upload chunk size. Must a power of 2 >= 256k. Default value is 8 MB.
|
|
|
|
|
|
|
|
Making this larger will improve performance, but note that each chunk
|
|
|
|
is buffered in memory one per transfer.
|
|
|
|
|
|
|
|
Reducing this will reduce memory usage but decrease performance.
|
2015-11-14 11:38:35 +00:00
|
|
|
|
|
|
|
#### --drive-full-list ####
|
|
|
|
|
2016-04-12 20:33:55 +00:00
|
|
|
No longer does anything - kept for backwards compatibility.
|
2015-11-14 11:38:35 +00:00
|
|
|
|
|
|
|
#### --drive-upload-cutoff=SIZE ####
|
|
|
|
|
2016-04-12 20:33:55 +00:00
|
|
|
File size cutoff for switching to chunked upload. Default is 8 MB.
|
2015-11-14 11:38:35 +00:00
|
|
|
|
|
|
|
#### --drive-use-trash ####
|
|
|
|
|
|
|
|
Send files to the trash instead of deleting permanently. Defaults to
|
|
|
|
off, namely deleting files permanently.
|
|
|
|
|
2016-01-02 18:47:05 +00:00
|
|
|
#### --drive-auth-owner-only ####
|
|
|
|
|
|
|
|
Only consider files owned by the authenticated user. Requires
|
|
|
|
that --drive-full-list=true (default).
|
|
|
|
|
2016-01-26 16:52:53 +00:00
|
|
|
#### --drive-formats ####
|
|
|
|
|
|
|
|
Google documents can only be exported from Google drive. When rclone
|
|
|
|
downloads a Google doc it chooses a format to download depending upon
|
|
|
|
this setting.
|
|
|
|
|
|
|
|
By default the formats are `docx,xlsx,pptx,svg` which are a sensible
|
|
|
|
default for an editable document.
|
|
|
|
|
|
|
|
When choosing a format, rclone runs down the list provided in order
|
|
|
|
and chooses the first file format the doc can be exported as from the
|
|
|
|
list. If the file can't be exported to a format on the formats list,
|
|
|
|
then rclone will choose a format from the default list.
|
|
|
|
|
|
|
|
If you prefer an archive copy then you might use `--drive-formats
|
|
|
|
pdf`, or if you prefer openoffice/libreoffice formats you might use
|
|
|
|
`--drive-formats ods,odt`.
|
|
|
|
|
|
|
|
Note that rclone adds the extension to the google doc, so if it is
|
|
|
|
calles `My Spreadsheet` on google docs, it will be exported as `My
|
|
|
|
Spreadsheet.xlsx` or `My Spreadsheet.pdf` etc.
|
|
|
|
|
|
|
|
Here are the possible extensions with their corresponding mime types.
|
|
|
|
|
|
|
|
| Extension | Mime Type | Description |
|
|
|
|
| --------- |-----------| ------------|
|
|
|
|
| csv | text/csv | Standard CSV format for Spreadsheets |
|
|
|
|
| doc | application/msword | Micosoft Office Document |
|
|
|
|
| docx | application/vnd.openxmlformats-officedocument.wordprocessingml.document | Microsoft Office Document |
|
|
|
|
| html | text/html | An HTML Document |
|
|
|
|
| jpg | image/jpeg | A JPEG Image File |
|
|
|
|
| ods | application/vnd.oasis.opendocument.spreadsheet | Openoffice Spreadsheet |
|
|
|
|
| ods | application/x-vnd.oasis.opendocument.spreadsheet | Openoffice Spreadsheet |
|
|
|
|
| odt | application/vnd.oasis.opendocument.text | Openoffice Document |
|
|
|
|
| pdf | application/pdf | Adobe PDF Format |
|
|
|
|
| png | image/png | PNG Image Format|
|
|
|
|
| pptx | application/vnd.openxmlformats-officedocument.presentationml.presentation | Microsoft Office Powerpoint |
|
|
|
|
| rtf | application/rtf | Rich Text Format |
|
|
|
|
| svg | image/svg+xml | Scalable Vector Graphics Format |
|
|
|
|
| txt | text/plain | Plain Text |
|
|
|
|
| xls | application/vnd.ms-excel | Microsoft Office Spreadsheet |
|
|
|
|
| xlsx | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | Microsoft Office Spreadsheet |
|
|
|
|
| zip | application/zip | A ZIP file of HTML, Images CSS |
|
|
|
|
|
2015-06-06 09:05:21 +00:00
|
|
|
### Limitations ###
|
2015-05-21 17:39:46 +00:00
|
|
|
|
|
|
|
Drive has quite a lot of rate limiting. This causes rclone to be
|
|
|
|
limited to transferring about 2 files per second only. Individual
|
|
|
|
files may be transferred much faster at 100s of MBytes/s but lots of
|
|
|
|
small files can take a long time.
|