We're working on a brand new Dropbox Wiki with better features and ease of access! Find out more. |
Using Dropbox CLI
From Dropbox Wiki
Contents |
Using the official Dropbox command line interface (CLI)
This article assumes you have already installed Dropbox as per the instructions here
Installation
Download the Dropbox command line interface or get it via the command line:
First make a bin directory, or a directory of your choosing. The examples below all assume you made a bin directory:
mkdir -p ~/bin
Download the CLI interface via wget:
wget -O ~/bin/dropbox.py "http://www.dropbox.com/download?dl=packages/dropbox.py"
Set the permissions so you can execute the CLI interface:
chmod +x ~/bin/dropbox.py
Getting Started
Start off by printing the help menu:
~/bin/dropbox.py help
which will show you all the commands you can use
status get current status of the dropboxd help provide help puburl get public url of a file in your dropbox stop stop dropboxd running return whether dropbox is running start start dropboxd filestatus get current sync status of one or more files ls list directory contents with current sync status autostart automatically start dropbox at login exclude ignores/excludes a directory from syncing
As the help menu shows, to start Dropbox, simply type
~/bin/dropbox.py start
If successful, it should show
Starting Dropbox...Done!
Then check its status with
~/bin/dropbox.py status
Commands
STATUS
Description
get current status of the dropboxd
Usage
Basic usage dropbox.py status
Example ~/bin/dropbox.py status
Combined with "watch" command watch '~/bin/dropbox.py status'
Sample output
$ ~/bin/dropbox.py status Indexing 317 files...
$ ~/bin/dropbox.py statusIdle
HELP
Description
provide help
Usage
Basic usage dropbox.py help
Example ~/bin/dropbox.py help
Command help usage dropbox.py help COMMAND
Example ~/bin/dropbox.py help exclude
Sample output
$ ~/bin/dropbox.py help Dropbox command-line interface commands: Note: use dropbox help <command> to view usage for a specific command. status get current status of the dropboxd help provide help puburl get public url of a file in your dropbox stop stop dropboxd running return whether dropbox is running start start dropboxd filestatus get current sync status of one or more files ls list directory contents with current sync status autostart automatically start dropbox at login exclude ignores/excludes a directory from syncing
$ ~/bin/dropbox.py help puburldropbox puburl FILE Prints out a public url for FILE.
PUBURL
Description
get public url of a file in your dropbox
Usage
Basic usage dropbox.py puburl FILE
Example ~/bin/dropbox.py puburl ~/Dropbox/Public/file.zip
Sample output
$ ~/bin/dropbox.py puburl ~/Dropbox/Public/file.zip http://dl.dropbox.com/u/XXXXXXX/file.zip
If not used on a file in your Public folder, you will get an error message:
$ ~/bin/dropbox.py puburl ~/Dropbox/myFolder/file.zip Couldn't get public url: Unknown Error
STOP
Description
stop dropboxd
Usage
Basic usage dropbox.py stop
Example ~/bin/dropbox.py stop
Sample output
$ ~/bin/dropbox.py stop Dropbox daemon stopped.
RUNNING
Description
return whether dropbox is running
Used in scripts to check if Dropbox is running. This command does not output anything to the user.
Extra Info
$ ~/bin/dropbox.py help running dropbox running Returns 1 if running 0 if not running.
Usage
Basic usage dropbox.py running
Example ~/bin/dropbox.py running
Sample output
$ ~/bin/dropbox.py running <no output>
EXCLUDE
Description
ignores/excludes a directory from syncing
Used in scripts to check if Dropbox is running. This command does not output anything to the user.
Extra Info
$ ~/bin/dropbox.py help exclude dropbox exclude [list] dropbox exclude add [DIRECTORY] [DIRECTORY] ... dropbox exclude remove [DIRECTORY] [DIRECTORY] ... "list" prints a list of directories currently excluded from syncing. "add" adds one or more directories to the exclusion list, then resynchronizes Dropbox. "remove" removes one or more directories from the exclusion list, then resynchronizes Dropbox. With no arguments, executes "list". Any specified path must be within Dropbox.
Usage
List usage: dropbox.py exclude list
Example ~/bin/dropbox.py exclude
Example ~/bin/dropbox.py exclude list
Add exclusion usage dropbox.py exclude add DIRECTORY
Example ~/bin/dropbox.py exclude add ~/Dropbox/MyExcludedFolder
Remove exclusion usage dropbox.py exclude remove DIRECTORY
Example ~/bin/dropbox.py exclude remove ~/Dropbox/MyReincludedFolder
Sample output
$ ~/bin/dropbox.py exclude list Excluded: Dropbox/backup Dropbox/documents Dropbox/music Dropbox/papers Dropbox/photos Dropbox/pictures
$ ~/bin/dropbox.py exclude add ~/Dropbox/MyExclude1 ~/Dropbox/MyExclude2 ~/Dropbox/MyExclude3[...]
