Dropbox linux command line upload [ CLI ] client

17. November 2012 SysAdmin 0

Issue

  • You are looking for dropbox linux command line upload client
  • You want to upload your server backups from Linux server to Dropbox accounts.

Resolution

With the Dropbox command line client, You can upload any files to your Dropbox account from the linux BASH terminal. This is as simple as copying files from a linux terminal , Like cp file1 file2 This can be used in any scenario like uploading backups from your server to your dropbox account etc. The bash script available for dropbox at GitHubwhich can be used with Various OS.

TESTED ENVIRONMENTS
– GNU Linux FreeBSD 8.3 MacOSX Windows/Cygwin Raspberry Pi
Portable: It’s written in BASH scripting language and only needs cURL (curl is a tool to transfer data from or to a server, available for all operating systems and installed by default in many linux distributions).
Secure: 
It’s not required to provide your username/password to this script, because it uses the official Dropbox API for authentication process.

How to Setup

– Create an account on www.dropbox.com (if you dont have one).
– Now go to your linux box, (curl and bash must be installed)[sociallocker]

[email protected]:~$ cd /tmp
[email protected]:/tmp$ wget https://raw.github.com/andreafabrizi/Dropbox-Uploader/master/dropbox_uploader.sh
[email protected]:/tmp$ sudo cp dropbox_uploader.sh /usr/local/bin/droptobox
[email protected]:/tmp$ chmod +x /usr/local/bin/droptobox

[/sociallocker]

Now you can access the program anywhere from the terminal by running droptobox command
– Lets run the command first time to setup the authentication.
[email protected]:/tmp$ droptobox
– It will ask you for the “App Key and App secret”, Lets create it from the Dropbox web.
– Go to https://www.dropbox.com/developers/apps and create an app.
Give “Full Access” while filling the App details. AWSADMNZ Dropbox api
– It will display an “App Key” and “App Secret” after successful creation.
– Copy both and give paste it on the terminal setup and give “f” in the access options.

App key: xxxxxxxxxxxxxx
App secret: xxxxxxxxxxxxxxx
Access level you have chosen, App folder or Full Dropbox [a/f]: f

– Then it will display a Link, Copy and paste it on the web browser and Allow the API access. [AWSADMNZ Dropbox CLI](https://res.cloudinary.com/jobnix/image/upload/v1415999865/jobnix-dropbox-cli_gdlrct.jpg "AWSADMNZ-dropbox-cli")
– Click “Allow” to allow the CLI access.
– Now on the terminal, Hit Enter, and your setup is now completed.

Command Usage

/usr/local/bin/droptobox COMMAND [PARAMETERS]…
Commands: upload [LOCAL_FILE] <REMOTE_FILE>
download [REMOTE_FILE] <LOCAL_FILE>
delete [REMOTE_FILE]
list <REMOTE_DIR>
info
unlink

Uploading Files

– Upload the files to your dropbox / directory
[email protected]MNZ:~$ droptobox upload file1 – Upload the files to your dropbox /Photos directory [email protected]:~$ droptobox file1 Photos/file1 – Upload Files with Space in their file name. [email protected]:~$ droptobox upload "My File.txt" "My File 2.txt"

Deleteing Files

-Delete the file Photos/file1
[email protected]:~$ droptobox delete Photos/file1

Downloding Files

– Download file1 [email protected]:~$ droptobox download file1
– Download Photos/file1 [email protected]:~$ droptobox download Photos/file1

Resources

GitHub ReadMe

Please like AWSADMINZ Facebook page if this article found helpful.
Tags : dropbox command line upload , dropbox linux command line upload ,  dropbox windows command line upload


Leave a Reply

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