• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

CHANGELOG.mdH A D18-Sep-20168.2 KiB222183

LICENSEH A D18-Sep-201634.3 KiB675553

README.mdH A D18-Sep-20167.1 KiB238172

dropShell.shH A D03-May-20228.5 KiB424280

dropbox_uploader.shH A D18-Sep-201640.9 KiB1,479961

testUnit.shH A D18-Sep-20162.1 KiB9462

README.md

1# Dropbox Uploader
2
3Dropbox 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.
4
5It's written in BASH scripting language and only needs **cURL**.
6
7**Why use this script?**
8
9* **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).
10* **Secure:** It's not required to provide your username/password to this script, because it uses the official Dropbox API v2 for the authentication process.
11
12Please 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.
13
14## Features
15
16* Cross platform
17* Support for the official Dropbox API v2
18* No password required or stored
19* Simple step-by-step configuration wizard
20* Simple and chunked file upload
21* File and recursive directory download
22* File and recursive directory upload
23* Shell wildcard expansion (only for upload)
24* Delete/Move/Rename/Copy/List/Share files
25* Create share link
26
27## Getting started
28
29First, clone the repository using git (recommended):
30
31```bash
32git clone https://github.com/andreafabrizi/Dropbox-Uploader.git
33```
34
35or download the script manually using this command:
36
37```bash
38curl "https://raw.githubusercontent.com/andreafabrizi/Dropbox-Uploader/master/dropbox_uploader.sh" -o dropbox_uploader.sh
39```
40
41Then give the execution permission to the script and run it:
42
43```bash
44 $chmod +x dropbox_uploader.sh
45 $./dropbox_uploader.sh
46```
47
48The first time you run `dropbox_uploader`, you'll be guided through a wizard in order to configure access to your Dropbox. This configuration will be stored in `~/.dropbox_uploader`.
49
50## Usage
51
52The syntax is quite simple:
53
54```
55./dropbox_uploader.sh [PARAMETERS] COMMAND...
56
57[%%]: Optional param
58<%%>: Required param
59```
60
61**Available commands:**
62
63* **upload** &lt;LOCAL_FILE/DIR ...&gt; &lt;REMOTE_FILE/DIR&gt;
64Upload a local file or directory to a remote Dropbox folder.
65If the file is bigger than 150Mb the file is uploaded using small chunks (default 4Mb);
66in this case a . (dot) is printed for every chunk successfully uploaded and a * (star) if an error
67occurs (the upload is retried for a maximum of three times).
68Only if the file is smaller than 150Mb, the standard upload API is used, and if the -p option is used
69the default curl progress bar is displayed during the upload process.
70The local file/dir parameter supports wildcards expansion.
71
72* **download** &lt;REMOTE_FILE/DIR&gt; [LOCAL_FILE/DIR]
73Download file or directory from Dropbox to a local folder
74
75* **delete** &lt;REMOTE_FILE/DIR&gt;
76Remove a remote file or directory from Dropbox
77
78* **move** &lt;REMOTE_FILE/DIR&gt; &lt;REMOTE_FILE/DIR&gt;
79Move or rename a remote file or directory
80
81* **copy** &lt;REMOTE_FILE/DIR&gt; &lt;REMOTE_FILE/DIR&gt;
82Copy a remote file or directory
83
84* **mkdir** &lt;REMOTE_DIR&gt;
85Create a remote directory on DropBox
86
87* **list** [REMOTE_DIR]
88List the contents of the remote Dropbox folder
89
90* **share** &lt;REMOTE_FILE&gt;
91Get a public share link for the specified file or directory
92
93* **saveurl** &lt;URL&gt; &lt;REMOTE_DIR&gt;
94Download a file from an URL to a Dropbox folder directly (the file is NOT downloaded locally)
95
96* **search** &lt;QUERY&gt;
97Search for a specific pattern on Dropbox and returns the list of matching files or directories
98
99* **info**
100Print some info about your Dropbox account
101
102* **space**
103Print some info about the space usage on your Dropbox account
104
105* **unlink**
106Unlink the script from your Dropbox account
107
108
109**Optional parameters:**
110* **-f &lt;FILENAME&gt;**
111Load the configuration file from a specific file
112
113* **-s**
114Skip already existing files when download/upload. Default: Overwrite
115
116* **-d**
117Enable DEBUG mode
118
119* **-q**
120Quiet mode. Don't show progress meter or messages
121
122* **-h**
123Show file sizes in human readable format
124
125* **-p**
126Show cURL progress meter
127
128* **-k**
129Doesn't check for SSL certificates (insecure)
130
131
132**Examples:**
133```bash
134    ./dropbox_uploader.sh upload /etc/passwd /myfiles/passwd.old
135    ./dropbox_uploader.sh upload *.zip /
136    ./dropbox_uploader.sh download /backup.zip
137    ./dropbox_uploader.sh delete /backup.zip
138    ./dropbox_uploader.sh mkdir /myDir/
139    ./dropbox_uploader.sh upload "My File.txt" "My File 2.txt"
140    ./dropbox_uploader.sh share "My File.txt"
141    ./dropbox_uploader.sh list
142```
143
144## Tested Environments
145
146* GNU Linux
147* FreeBSD 8.3/10.0
148* MacOSX
149* Windows/Cygwin
150* Raspberry Pi
151* QNAP
152* iOS
153* OpenWRT
154* Chrome OS
155* OpenBSD
156
157If you have successfully tested this script on others systems or platforms please let me know!
158
159## Running as cron job
160Dropbox Uploader relies on a different configuration file for each system user. The default configuration file location is `$HOME/.dropbox_uploader`. This means that if you setup the script with your user and then you try to run a cron job as root, it won't work.
161So, when running this script using cron, please keep in mind the following:
162* Remember to setup the script with the user used to run the cron job
163* Always specify the full script path when running it (e.g.  /path/to/dropbox_uploader.sh)
164* Use always the -f option to specify the full configuration file path, because sometimes in the cron environment the home folder path is not detected correctly (e.g. -f /home/youruser/.dropbox_uploader)
165* My advice is, for security reasons, to not share the same configuration file with different users
166
167## How to setup a proxy
168
169To use a proxy server, just set the **https_proxy** environment variable:
170
171**Linux:**
172```bash
173    export HTTP_PROXY_USER=XXXX
174    export HTTP_PROXY_PASSWORD=YYYY
175    export https_proxy=http://192.168.0.1:8080
176```
177
178**BSD:**
179```bash
180    setenv HTTP_PROXY_USER XXXX
181    setenv HTTP_PROXY_PASSWORD YYYY
182    setenv https_proxy http://192.168.0.1:8080
183```
184
185## BASH and Curl installation
186
187**Debian & Ubuntu Linux:**
188```bash
189    sudo apt-get install bash (Probably BASH is already installed on your system)
190    sudo apt-get install curl
191```
192
193**BSD:**
194```bash
195    cd /usr/ports/shells/bash && make install clean
196    cd /usr/ports/ftp/curl && make install clean
197```
198
199**Cygwin:**
200You need to install these packages:
201* curl
202* ca-certificates
203* dos2unix
204
205Before running the script, you need to convert it using the dos2unix command.
206
207
208**Build cURL from source:**
209* Download the source tarball from http://curl.haxx.se/download.html
210* Follow the INSTALL instructions
211
212## DropShell
213
214DropShell is an interactive DropBox shell, based on DropBox Uploader:
215
216```bash
217DropShell v0.2
218The Intractive Dropbox SHELL
219Andrea Fabrizi - andrea.fabrizi@gmail.com
220
221Type help for the list of the available commands.
222
223andrea@Dropbox:/$ ls
224 [D] 0       Apps
225 [D] 0       Camera Uploads
226 [D] 0       Public
227 [D] 0       scripts
228 [D] 0       Security
229 [F] 105843  notes.txt
230andrea@DropBox:/ServerBackup$ get notes.txt
231```
232
233## Donations
234
235 If you want to support this project, please consider donating:
236 * PayPal: andrea.fabrizi@gmail.com
237 * BTC: 1JHCGAMpKqUwBjcT3Kno9Wd5z16K6WKPqG
238