forked from dbough/Dropbox-Uploader-Compress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRM.ORIG
140 lines (100 loc) · 4.02 KB
/
RM.ORIG
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Dropbox Uploader
Dropbox Uploader is a **BASH** script which can be used to upload, download, delete, list files (and more!) from **Dropbox**, an online file sharing, synchronization and backup service.
It's written in BASH scripting language and only needs **cURL**.
**Why use this script?**
* **Portable:** It's written in BASH scripting 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 the authentication process.
Please refer to the [Wiki](https://github.com/andreafabrizi/Dropbox-Uploader/wiki) for tips and additional information about this project. The Wiki is also the place where you can share your scripts and examples related to Dropbox Uploader.
## Usage
The syntax is quite simple:
```
./dropbox_uploader.sh COMMAND [PARAMETERS]...
[%%]: Required param
<%%>: Optional param
```
**Available commands:**
* **upload** [LOCAL_FILE/DIR] <REMOTE_FILE/DIR>
Upload a local file or directory to a remote Dropbox folder.
If the file is bigger than 150Mb the file is uploaded using small chunks (default 4Mb);
in this case, if VERBOSE is set to 1, a . (dot) is printed for every chunk successfully uploaded.
Instead, if an error occurs during the chunk uploading, a * (star) is printed and the upload
is retried for a maximum of three times.
Only if the file is smaller than 150Mb, the standard upload API is used, and if VERBOSE is set
to 1 the default curl progress bar is displayed during the upload process.
* **download** [REMOTE_FILE/DIR] <LOCAL_FILE/DIR>
Download file or directory from Dropbox to a local folder
* **delete** [REMOTE_FILE/DIR]
Remove a remote file or directory from Dropbox
* **move** [REMOTE_FILE/DIR] [REMOTE_FILE/DIR]
Move o rename a remote file or directory
* **mkdir** [REMOTE_DIR]
Create a remote directory on DropBox
* **list** <REMOTE_DIR>
List the contents of the remote Dropbox folder
* **share** [REMOTE_FILE]
Get a public share link for the specified file or directory
* **info**
Print some info about your Dropbox account
* **unlink**
Unlink the script from your Dropbox account
**Optional parameters:**
* **-f [FILENAME]**
Load the configuration file from a specific file
**Examples:**
```bash
./dropbox_uploader.sh upload /etc/passwd /myfiles/passwd.old
./dropbox_uploader.sh upload /etc/passwd
./dropbox_uploader.sh download /backup.zip
./dropbox_uploader.sh delete /backup.zip
./dropbox_uploader.sh mkdir /myDir/
./dropbox_uploader.sh upload "My File.txt" "My File 2.txt" (File name with spaces...)
./dropbox_uploader.sh share "My File.txt"
```
## Tested Environments
* GNU Linux
* FreeBSD 8.3
* MacOSX
* Windows/Cygwin
* Raspberry Pi
* QNAP
* iOS
* OpenWRT
If you have successfully tested this script on others systems or platforms please let me know!
## How to setup a proxy
To use a proxy server, just set the **https_proxy** environment variable:
**Linux:**
```bash
export HTTP_PROXY_USER=XXXX
export HTTP_PROXY_PASSWORD=YYYY
export https_proxy=http://192.168.0.1:8080
```
**BSD:**
```bash
setenv HTTP_PROXY_USER XXXX
setenv HTTP_PROXY_PASSWORD YYYY
setenv https_proxy http://192.168.0.1:8080
```
## BASH and Curl installation
**Debian & Ubuntu Linux:**
```bash
sudo apt-get install bash (Probably BASH is already installed on your system)
sudo apt-get install curl
```
**BSD:**
```bash
cd /usr/ports/shells/bash && make install clean
cd /usr/ports/ftp/curl && make install clean
```
**Cygwin:**
You need to install these packages:
* curl
* ca-certificates
**Build cURL from source:**
* Download the source tarball from http://curl.haxx.se/download.html
* Follow the INSTALL instructions
## Getting started
The first time you use Dropbox Uploader, you have to run these commands:
```bash
$chmod +x dropbox_uploader.sh
$./dropbox_uploader.sh
```