DBXCLI - Dropbox Command Line Tool
A command line tool for Dropbox users and team admins
DBXCLI is a command line client for Dropbox built using the Go SDK. With it you can upload files, download files, automate Dropbox backups, and much more!
- Supports basic file operations like ls, cp, mkdir, mv (via the Files API)
- Supports search
- Supports file revisions and file restore
- Chunked uploads for large files, paginated listing for large directories
- Supports a growing set of Team operations
Download pre-compiled binaries for Mac, Windows and Linux from the releases page: https://github.com/dropbox/dbxcli/releases.
DBXCLI is portable, which means that to install all you have to do is download and execute. But it is preferable to have the binary on your path this way you can call it from any directory.
For the Mac the instructions to do just that are below.
Make sure you download and place the binary in a folder that's on your $PATH. If you have such directory reserved for such purpose skip to step 3.
Create a bin directory under your home directory.
mkdir ~/bin cd ~/bin
Add the following line at the end of your ~/.bash_profile file.
- Download the dbxcli binary for OSX and rename it.
wget https://github.com/dropbox/dbxcli/releases/download/v2.1.1/dbxcli-darwin-amd64 mv dbxcli-darwin-amd64 dbxcli
- Finally, make the binary an executable file and you are good to go!
chmod +x dbxcli
That's it! DBXCLI should be now ready to get to work.
dbxcli is largely self documenting. Run
dbxcli -h for a list of supported commands:
dbxcli --help Use dbxcli to quickly interact with your Dropbox, upload/download files, manage your team and more. It is easy, scriptable and works on all platforms! Usage: dbxcli [command] Available Commands: cp Copy files du Display usage information get Download a file ls List files mkdir Create a new directory mv Move files put Upload files restore Restore files revs List file revisions rm Remove files search Search team Team management commands version Print version information Flags: --as-member string Member ID to perform action as -v, --verbose Enable verbose logging Use "dbxcli [command] --help" for more information about a command. $ dbxcli team --help Team management commands Usage: dbxcli team [command] Available Commands: add-member Add a new member to a team info Get team information list-groups List groups list-members List team members remove-member Remove member from a team Global Flags: --as-member string Member ID to perform action as -v, --verbose Enable verbose logging Use "dbxcli team [command] --help" for more information about a command.
The --verbose option will turn on verbose logging and is useful for debugging.
First we have to add an account to dbxcli. To do that execute:
The program will output a link, just copy and paste that link into your browser's address bar. DBXCLI works with Dropbox API so you need to authorize it to work in your Dropbox folder. After logging into Dropbox click the
Once you click in the Allow button Dropbox's site will display a key of alpha-numeric characters. Copy it and paste into the terminal:
mteam7 [~] $ dbxcli account 1. Go to https://www.dropbox.com/1/oauth2/authorize?client_id=06a7d1f28621cj8q769&response_type=code&state=state 2. Click "Allow" (you might have to log in first). 3. Copy the authorization code. Enter the authorization code here: XXXXXXXX_HERE_GOES_YOUR_KEY_XXXXXXXX
After that you are ready to use it.
For instance to copy the local file ~/Document.docx to a folder called Docs inside your Dropbox do:
dbxcli put ~/Document.docx /Docs/Document.docx
To download files use
get. Like this:
dbxcli get /Excel/Sheet.xlsx ~/MyLocalDir/Sheet.xlsx
In order to automate these tasks you need to use some sort of task scheduler program. Fortunately all major OSs comes with one already.
For Macs and Linuxes use the cron. For Windows, you can use Task Scheduler.
Also note that for regular Dropbox account you can have up to 30 days of file revisions. Which means with you overwrite the same backup file over and over you can get the last 30 days revisions for that file. This period is extended Dropbox Business.