Created
June 21, 2022 21:23
-
-
Save antoine-briand/5c37651320b35f23433b3c107528c4aa to your computer and use it in GitHub Desktop.
Backup dropbox business accounts using rclone
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
: ' | |
This script helps me to backup Dropbox business accounts. Requires rclone to be installed on your machine (https://rclone.org/downloads/). | |
You must create a dropbox application (https://www.dropbox.com/developers/apps) with all READ scopes. | |
Then configure your rclone using rclone config | |
1) Choose dropbox | |
2) Set your remote name | |
3) On client_id, paste the value you have for "App key" on your Dropbox app (in settings) | |
4) On client_secret, paste the value you have for "App secret" on your Dropbox app (in settings) | |
5) Edit advanced config and set a value to the impersonate parameter (your admin account email e.g) | |
6) Do not edit other advanced config | |
7) On servers do not use auto config (n). On workstation use auto config. Either way, you must | |
Once rclone is configured, check if you can access dropbox business users by running : | |
rclone --dropbox-impersonate "[email protected]" lsd "remoteName": | |
To use the following script, simply create a .sh file and grant execution rights (chmod u+x myscript.sh). | |
Then run the script and do not forget to pass one of your user email adress as parameter. | |
Eg | |
./myscript.sh "[email protected]" | |
' | |
USER_EMAIL=$1 | |
USER_BACKUP_PATH="./backed_up_data/$USER_EMAIL" | |
LOGS_PATH="log_$USER_EMAIL.txt" | |
echo "Backuping user $USER_EMAIL" >> ./$LOGS_PATH | |
mkdir -p $USER_BACKUP_PATH | |
rclone --log-file=./$LOGS_PATH --log-level=INFO --dropbox-impersonate "$USER_EMAIL" copy "dropbox": $USER_BACKUP_PATH/ | |
echo "Backup of user $USER_EMAIL finished" >> ./$LOGS_PATH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To run the script for all users :
parallel -a users.txt ./do_backup.sh
It will copy your users dropbox data in parallel.