install
sudo -v ; curl https://rclone.org/install.sh | sudo bash
connect to Google Drive API
-
Get the client ID and client secret
- Go to https://console.developers.google.com/ and login with a google account (not important to be same with your Google Drive account)
- Select a project or create a new one
- Go to
ENABLE APIS AND SERVICES
and search forGoogle Drive API
at top search bar and enable this - Click on
Credentials
in left side panel - You should configure Consent Screen if you did not before. To this end, click on
CONFIGURE CONSENT SCREEN
button at top right - Select
External
andCREATE
-> Enter App name, User Support Email, and Developer Contact Email with deliberate things and clicksave
- Add the
auth/docs
Google Drive API scope to the list of scopes to have the read only permission of content (for download) -> clickSave and continue
- ADD YOUR GOOGLE DRIVE ACCOUNT EMAIL IN THE TEST USERS
- Go to
Credentials
again -> Click on+ CREATE CREDENTIALS
at top ->OAuth client ID
- Choose
Desktop app
and click onCreate
- Note the
Client ID
andClient Secret
provided here - This would be
Testing
app and the access will only be valid for only one week. After that, you should grant access again, which is easy. You can also publish your app to prevent this but it might throw some confirmation when you are configuring for remote according to docs.
-
Configure
rclone
with new remote usingrclone config
. Then enter the details and not go for advanced configurations (defaults are enough). The remote type code is17
(Google Drive) and the access request should be2
(Read-only) -
After configuring the remote, you can list directories and files separately using following commands:
# list directories rclone lsd <remote_name>: rclone ls <remote_name>:
-
To download a file:
# -P or --progress and -v flag for verbose output
rclone -P -v copy <remote_name>:file_name.txt .