forked from andreafabrizi/Dropbox-Uploader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
258 lines (185 loc) · 7.85 KB
/
README
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
Author: Andrea Fabrizi
Email: [email protected]
Web: http://www.andreafabrizi.it
Dropbox Uploader is a BASH script which can be used to upload, download, delete or list files 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 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.
USAGE:
======
Usage: ./dropbox_uploader.sh COMMAND [PARAMETERS]...
[%%]: Required param
<%%>: Optional param
Commands:
upload [LOCAL_FILE] <REMOTE_FILE>
- Upload local file to 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, an * (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] <LOCAL_FILE>
- Download file from Dropbox to local folder
downloaddir [REMOTE_DIRECTORY] [LOCAL_DIRECTORY]
- Download directory from Dropbox to local folder recursively
delete [REMOTE_FILE/REMOTE_DIRECTORY]
- Remove a remote file from Dropbox
mkdir [REMOTE_DIRECTORY]
- Create a remote directory on DropBox
list <REMOTE_DIRECTORY>
- List contents of the remote Dropbox folder
share [REMOTE_FILE]
- Get a public share link for the specified file
info
- Print some info about your Dropbox account
unlink
- Unlink this script from your Dropbox account
Optional parameters:
-f [FILENAME]
Load the configuration file from a specific file
Examples:
./dropbox_uploader.sh upload /etc/passwd /myfiles/passwd.old
./dropbox_uploader.sh upload /etc/passwd
./dropbox_uploader.sh download /backup.zip
./dropbox_uploader.sh downloaddir /myDir/ /myLocalDir/
./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
If you have successfully tested this script on others systems or platforms please let me know!
HOW TO USE A PROXY:
===================
To use a proxy server, simply set the "https_proxy" environment variable:
### Linux:
export HTTP_PROXY_USER=XXXX
export HTTP_PROXY_PASSWORD=YYYY
export https_proxy=http://192.168.0.1:8080
### BSD:
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:
sudo apt-get install bash (Probably bash is already installed on your system)
sudo apt-get install curl
### BSD:
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
DROPBOX UPLOADER FIRST START:
=============================
$chmod +x dropbox_uploader.sh
$./dropbox_uploader.sh
CHANGELOG:
==========
Version 0.11.6 - 15 Mar 2013
- Add optional command-line parameter ('-f') to read dropbox configuration from a specific file (thanks to pjv)
Version 0.11.5 - 22 Gen 2013
- Added the ability to get a share link for a specified file (thanks to camspiers)
Version 0.11.4 - 17 Gen 2013
- Fix for QNAP compatibility (thanks to Fritz Ferstl)
- Implemented mkdir command (thanks to Joel Maslak)
- Fix for Solaris compatibility
Version 0.11.3 - 22 Dec 2012:
- Improved list command (thanks to Robert González)
- Fixed problem with unicode characters
Version 0.11.2 - 14 Nov 2012:
- Added a check for the free quota before uploading a file
- Now the quota informations are displayed in Mb
- Removed urlencode function for incompatibility with older curl versions
- Fixed problem uploading files that contains @ character
- Minor changes
Version 0.11.1 - 12 Nov 2012:
- As suggested by the DropBox API documentation, the default chunk for chunked uploads is now 4Mb
- Minor changes
Version 0.11 - 11 Nov 2012:
- Parameterized the curl binary location
- Fix for MacOSX 10.8 (thanks to Ben - www.aquiltforever.com)
Version 0.10 - 03 Nov 2012:
- Code clean
- Improved urlencode function (thanks to Stefan Trauth - www.stefantrauth.de)
- Added command remove as alias of delete
- Fix for Raspberry PI
- Now if an error occurs during a chunk uploading, the upload is retried for a maximum of three times
- Minor changes
- Tested on Cygwin and MacOSX
Version 0.9.9 - 24 Oct 2012:
- Added the possibility to choose the access level (App folder o Full Dropbox) during the setup procedure
- Added a check for the BASH shell version
- Fixed problems in listing files/directories with special characters
- Added the option CURL_ACCEPT_CERTIFICATES (see the script source)
- Added back the standard upload function. Now only if the file is greater than 150Mb, the chunked_upload API will be used.
- Fixed compatibility with bsd sed. Tested on FreeBSD, but probably it works on others bsd versions and osx. Let me know!
- Minor changes
Version 0.9.8 - 03 Oct 2012:
- Implemented chunked upload. Now there is no limit to file size!
Version 0.9.7 - 14 Sep 2012:
- Fixed bug in listing empty directories
Version 0.9.6 - 12 Sep 2012:
- Implemented list command
- Minor changes
Version 0.9.5 - 18 Jul 2012:
- Added a check for the maximum file size allowed by the DropBox API
- Minor changes
Version 0.9.4 - 19 Mar 2012:
- Implemented delete command
- Minor changes
Version 0.9.3 - 01 Mar 2012:
- Implemented download command
- Improved info output
- Fixed utime function
- Added dependency check for basename
- The script always returns 1 when errors occurs
- Improved error handling
- Fixed problem with spaces in config file name
- Minor bug fixes
Version 0.9.2 - 28 Feb 2012:
- Increased security, now any user can create his own Dropbox App
Version 0.9.1 - 27 Feb 2012:
- Fixed problem with spaces in dst file name
Version 0.9 - 27 Feb 2012:
- Code rewritten from scratch (CLI changed)
- Improved security and stability using official dropbox API, no more username/password needed!
Version 0.8.2 - 07 Sep 2011:
- Removed INTERACTIVE_MODE variable (now the progress bar is shown in VERBOSE mode)
- Improved command line interface and error messages
- Minor bug fixes
Version 0.8.1 - 31 Aug 2011 (by Dawid Ferenczy - www.ferenczy.cz)
- added prompt for the Dropbox password from keyboard, if there is no password
hardcoded or given as script command line parameter (interactive mode)
- added INTERACTIVE_MODE variable - when set to 1 show CURL progress bar.
Set to 1 automatically when there is no password hardcoded or given as
parameter. Controls verbosity of CURL.
Version 0.7.1 - 10 Mar 2011:
- Minor bug fixes
Version 0.7 - 10 Mar 2011:
- New command line interface
- Code clean
Version 0.6 - 11 Gen 2011:
- Fixed issue with spaces in file/forder name
Version 0.5 - 04 Gen 2011:
- Recursive directory upload
Version 0.4 - 29 Dec 2010:
- Now works on BSD and MAC
- Interactive prompt for username and password
- Speeded up the uploading process
- Debug mode
Version 0.3 - 18 Nov 2010:
- Regex updated
Version 0.2 - 04 Sep 2010:
- Removed dependencies from tempfile
- Code clean
Version 0.1 - 23 Aug 2010:
- Initial release