Manage Dropbox in Terminal With Dropbox Uploader

The good thing about Dropbox is that it has a desktop client for almost every OS and mobile device. However, if you need to access Dropbox from your server, or from a small device, like Raspberry Pi, that doesn’t allow you to install the Dropbox client, a better solution is to be able to manage your Dropbox account directly from the terminal (with command line). This is where the Dropbox Uploader script comes in useful.

Dropbox Uploader is a BASH script which can be used to upload, download, list or delete files from Dropbox. The good thing about it is that it doesn’t require you to enter your Dropbox’s username and password. It makes use of the Dropbox API to connect to your Dropbox account so you can transfer your files without worrying about the leak of your password.

There is only two things that are required for Dropbox Uploader to work: Bash (obviously) and cURL. Bash is included in almost every Linux distro, unless you removed it manually. You will need to install cURL if it is not currently intalled in your system. In Ubuntu-based distro:

sudo apt-get install curl

To install Dropbox Uploader, first grab the script from its Github site:

curl "https://raw.github.com/andreafabrizi/Dropbox-Uploader/master/dropbox_uploader.sh" -o /tmp/dropbox_uploader.sh

Then move it to the “bin” folder:

sudo install /tmp/dropbox_uploader.sh /usr/local/bin/dropbox_uploader

To get started, simply use the command:

dropbox_uploader

For the first run, it will show you an App name and prompt you to create a Dropbox app with this app name.

dropbox-uploader-app-name

Go to Dropbox Developer site and create an app.

dropbox-uploader-create-app

Here are a few settings that you should set for your app:

  • Type of app: Dropbox API app
  • Type of data: Files and datastores
  • Type of files: All file types

For the app limitation, you can set it to access only files it creates, or all the files in Dropbox.

Back in the terminal, enter the App Key and secret and visit the Dropbox authorization link to grant Dropbox Uploader permission to access your Dropbox account. Once you linked up Dropbox Uploader to your Dropbox account, you will be able to manage your Dropbox in the terminal.

The usage is pretty simple. There are 10 commands that you can use with Dropbox Uploader:

  • upload
  • download
  • delete
  • move
  • copy
  • mkdir
  • list
  • share
  • info
  • unlink

To upload a file/folder, use the syntax:

dropbox_uploader upload /filepath/to/file-or-folder /filepath/in/dropbox

If the “filepath/in/dropbox” is omitted, the file(s) will be uploaded to the topmost level of your Dropbox account.

To download a file/folder,

dropbox_uploader download /filpath/to/file-or-folder/in/Dropbox /filepath/in/local/machine

To list down all the files in a folder in your Dropbox account,

dropbox_uploader list /filepath/to/folder/in/Dropbox

To grab the public link for a particular file in Dropbox,

dropbox_uploader share /filepath/to/file/in/Dropbox

Dropbox Uploader provides a good way for you to access and manage your Dropbox account directly from the terminal. It is particularly useful for web administrators to use in their server. Coupled with a simple backup script and cron job, you can easily automate server backup to Dropbox.