How to backup your files to Dropbox using bash

Download the dropbox-uploader script by Andrea Fabrizi from github as root


wget https://raw.github.com/andreafabrizi/Dropbox-Uploader/master/dropbox_uploader.sh --no-check-certificate

make it executable and run it


chmod +x dropbox_uploader.sh
./dropbox_uploader.sh

when executed for the first time you will be prompted with some some instructions to be able to upload/download to your dropbox account.
In short, you need to create a developer account and create an app that this little script will talk to.
So, head over to :

https://www2.dropbox.com/developers/apps

and click on “Create an App”, fill in the form with the following data:

App name: MyUploader<number>
Description: What do you want…
Access level: App folder or Full Dropbox

Now, click on the “Create” button.

When your new App is successfully created, please enter the App Key, App Secret and the Access level into the script:


# App key: <key>
# App secret: <secret>
# Access level you have chosen, App folder or Full Dropbox [a/f]: 

The script will then show a confirmation question, if all information is correct, enter “y”
The script will now display:


Token request... 

while requesting access and if all is well it will turn into:


Token request... OK

A URL is now displayed that you need to visit to confirm access for the Dropbox Uploader to your dropbox account.
it will look something like this:



https://www2.dropbox.com/1/oauth/authorize?oauth_token=<token>

Press enter when done…
If you take to long time to visit the URL, you will need to CTRL+C and start over again. If everything went ok, you will see this:


Access Token request... OK

Setup completed!

You can now upload/download files to your dropbox account with cli.


Usage: ./dropbox_uploader.sh COMMAND [PARAMETERS]...

Commands:
         upload   [LOCAL_FILE]  
         download [REMOTE_FILE] 
         delete   [REMOTE_FILE/REMOTE_DIR]
         mkdir    [REMOTE_DIR]
         list     
         share    [REMOTE_FILE]
         info
         unlink

Leave a Reply

Your email address will not be published. Required fields are marked *