p:: CLI

  • https://github.com/rclone/rclone
  • Rclone (“rsync for cloud storage”) is a command-line program to sync files and directories to and from different cloud storage providers.

Install

curl https://rclone.org/install.sh | sudo bash

Dropbox

Get your own Dropbox App ID

  • https://www.dropbox.com/developers/apps/create
  • Create App
  • Switch to the Permissions tab. Enable at least the following permissions: account_info.readfiles.metadata.writefiles.content.writefiles.content.readsharing.write. The files.metadata.read and sharing.read checkboxes will be marked too. Click Submit
  • Switch to the Settings tab. Fill OAuth2 - Redirect URIs as http://localhost:53682/
  • The App key setting corresponds to client_id in rclone config, the App secret corresponds to client_secret
rclone config
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> dropbox
Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
 1 / 1Fichier
   \ (fichier)
 2 / Akamai NetStorage
   \ (netstorage)
 
...
 
45 / premiumize.me
   \ (premiumizeme)
46 / seafile
   \ (seafile)
Storage> dropbox
Option client_id.
OAuth Client Id.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_id> **********
Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_secret> **********
Edit advanced config?
y) Yes
n) No (default)
y/n> n
Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine
 
y) Yes (default)
n) No
y/n> N
Option config_token.
For this to work, you will need rclone available on a machine that has
a web browser available.
For more help and alternate methods see: https://rclone.org/remote_setup/
Execute the following on the machine with the web browser (same rclone
version recommended):
        rclone authorize "dropbox" "eyJjbGllbnRfaWQiOiI2d2ZwNGdzM3E5ajkyaWsiLCJjbGllbn..."
Then paste the result.
Enter a value.
config_token>
rclone authorize "dropbox" "eyJjbGllbnRfaWQiOiI2d2ZwNGdzM3E5ajkyaWsiLCJjbGllbn..."
2022/05/08 18:09:10 NOTICE: Config file "/Users/adithya321/.config/rclone/rclone.conf" not found - using defaults
2022/05/08 18:09:10 NOTICE: Make sure your Redirect URL is set to "http://localhost:53682/" in your custom config.
2022/05/08 18:09:10 NOTICE: If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=bj-BRhT70_Kvh8sy18
2022/05/08 18:09:10 NOTICE: Log in and authorize rclone for access
2022/05/08 18:09:10 NOTICE: Waiting for code...
2022/05/08 18:09:16 NOTICE: Got code
Paste the following into your remote machine --->
eyJ0b2tlbiI6IntcImFjY2Vzc190b2tlblwiOlwic2wuQkhOaWE5WkVkelRKYUFQMkc0SEstNU5rTktsSlJLLXlza1BRc3MtT18wek83SnhCZ3F4NllkTTBm...
<---End paste
config_token> eyJ0b2tlbiI6IntcImFjY2Vzc190b2tlblwiOlwic2wuQkhOaWE5WkVkelRKYUFQMkc0SEstNU5rTktsSlJLLXlza1BRc3MtT18wek83SnhCZ3F4NllkTTBm...
--------------------
[dropbox]
type = dropbox
client_id = **********
client_secret = **********
token = {"access_token":"sl.BHNia9ZEdzTJaAP2G4HK-5NkNKlJRK-yskPQss-O_0zO7JxBgqx6YdM0fUDhj...","token_type":"bearer","refresh_token":"ktDITCTAb5oAAAAAAAAAATFjp9sN1QdZA3qYwNCe...","expiry":"2022-05-08T22:09:19.121753+05:30"}
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:
 
Name                 Type
====                 ====
dropbox              dropbox
 
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q

To copy a local directory to a dropbox directory called backup

rclone copy /home/source dropbox:backup