mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-04 22:00:34 +08:00
97 lines
4.0 KiB
Markdown
97 lines
4.0 KiB
Markdown
|
How to access Dropbox from the command line in Linux
|
||
|
================================================================================
|
||
|
Cloud storage is everywhere in today's multi-device environment, where people want to access content across multiple devices wherever they go. Dropbox is the most widely used cloud storage service thanks to its elegant UI and flawless multi-platform compatibility. The popularity of Dropbox has led to a flurry of official or unofficial Dropbox clients that are available across different operating system platforms.
|
||
|
|
||
|
Linux has its own share of Dropbox clients: CLI clients as well as GUI-based clients. [Dropbox Uploader][1] is an easy-to-use Dropbox CLI client written in BASH scripting language. In this tutorial, I describe** how to access Dropbox from the command line in Linux by using Dropbox Uploader**.
|
||
|
|
||
|
### Install and Configure Dropbox Uploader on Linux ###
|
||
|
|
||
|
To use Dropbox Uploader, download the script and make it executable.
|
||
|
|
||
|
$ wget https://raw.github.com/andreafabrizi/Dropbox-Uploader/master/dropbox_uploader.sh
|
||
|
$ chmod +x dropbox_uploader.sh
|
||
|
|
||
|
Make sure that you have installed curl on your system, since Dropbox Uploader runs Dropbox APIs via curl.
|
||
|
|
||
|
To configure Dropbox Uploader, simply run dropbox_uploader.sh. When you run the script for the first time, it will ask you to grant the script access to your Dropbox account.
|
||
|
|
||
|
$ ./dropbox_uploader.sh
|
||
|
|
||
|
![](https://c2.staticflickr.com/6/5739/22860931599_10c08ff15f_c.jpg)
|
||
|
|
||
|
As instructed above, go to [https://www.dropbox.com/developers/apps][2] on your web browser, and create a new Dropbox app. Fill in the information of the new app as shown below, and enter the app name as generated by Dropbox Uploader.
|
||
|
|
||
|
![](https://c2.staticflickr.com/6/5745/22932921350_4123d2dbee_c.jpg)
|
||
|
|
||
|
After you have created a new app, you will see app key/secret on the next page. Make a note of them.
|
||
|
|
||
|
![](https://c1.staticflickr.com/1/736/22932962610_7db51aa718_c.jpg)
|
||
|
|
||
|
Enter the app key and secret in the terminal window where dropbox_uploader.sh is running. dropbox_uploader.sh will then generate an oAUTH URL (e.g., https://www.dropbox.com/1/oauth/authorize?oauth_token=XXXXXXXXXXXX).
|
||
|
|
||
|
![](https://c1.staticflickr.com/1/563/22601635533_423738baed_c.jpg)
|
||
|
|
||
|
Go to the oAUTH URL generated above on your web browser, and allow access to your Dropbox account.
|
||
|
|
||
|
![](https://c1.staticflickr.com/1/675/23202598606_6110c1a31b_c.jpg)
|
||
|
|
||
|
This completes Dropbox Uploader configuration. To check whether Dropbox Uploader is successfully authenticated, run the following command.
|
||
|
|
||
|
$ ./dropbox_uploader.sh info
|
||
|
|
||
|
----------
|
||
|
|
||
|
Dropbox Uploader v0.12
|
||
|
|
||
|
> Getting info...
|
||
|
|
||
|
Name: Dan Nanni
|
||
|
UID: XXXXXXXXXX
|
||
|
Email: my@email_address
|
||
|
Quota: 2048 Mb
|
||
|
Used: 13 Mb
|
||
|
Free: 2034 Mb
|
||
|
|
||
|
### Dropbox Uploader Examples ###
|
||
|
|
||
|
To list all contents in the top-level directory:
|
||
|
|
||
|
$ ./dropbox_uploader.sh list
|
||
|
|
||
|
To list all contents in a specific folder:
|
||
|
|
||
|
$ ./dropbox_uploader.sh list Documents/manuals
|
||
|
|
||
|
To upload a local file to a remote Dropbox folder:
|
||
|
|
||
|
$ ./dropbox_uploader.sh upload snort.pdf Documents/manuals
|
||
|
|
||
|
To download a remote file from Dropbox to a local file:
|
||
|
|
||
|
$ ./dropbox_uploader.sh download Documents/manuals/mysql.pdf ./mysql.pdf
|
||
|
|
||
|
To download an entire remote folder from Dropbox to a local folder:
|
||
|
|
||
|
$ ./dropbox_uploader.sh download Documents/manuals ./manuals
|
||
|
|
||
|
To create a new remote folder on Dropbox:
|
||
|
|
||
|
$ ./dropbox_uploader.sh mkdir Documents/whitepapers
|
||
|
|
||
|
To delete an entire remote folder (including all its contents) on Dropbox:
|
||
|
|
||
|
$ ./dropbox_uploader.sh delete Documents/manuals
|
||
|
|
||
|
--------------------------------------------------------------------------------
|
||
|
|
||
|
via: http://xmodulo.com/access-dropbox-command-line-linux.html
|
||
|
|
||
|
作者:[Dan Nanni][a]
|
||
|
译者:[译者ID](https://github.com/译者ID)
|
||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||
|
|
||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||
|
|
||
|
[a]:http://xmodulo.com/author/nanni
|
||
|
[1]:http://www.andreafabrizi.it/?dropbox_uploader
|
||
|
[2]:https://www.dropbox.com/developers/apps
|