Dropbox Uploader

Dropbox Uploader is a BASH script which can be used to upload, download, list or delete files from Dropbox, an online file sharing, synchronization and backup service. I initially written this script to schedule automatic server backups to a DropBox folder :)

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.



More info and source code on github: https://github.com/andreafabrizi/Dropbox-Uploader

If you want to support this project, please consider donating:
  1. PayPal: andrea.fabrizi [at] gmail.com
  2. BTC: 1JHCGAMpKqUwBjcT3Kno9Wd5z16K6WKPqG

#0 - Philip [2010-10-22 20:01:19 CET]

Excellent script ! Exactly what I needed. Thanks !
#1 - Monica B [2010-11-05 22:23:46 CET]

Thanks1
#2 - Shane [2010-11-19 18:53:57 CET]

Just what I was looking for!!! Thank you.
#3 - maravento [2010-11-23 22:53:44 CET]

Muchas Gracias. Thanks a lot friend. You save me

www.maravento.com
#4 - vovs [2010-11-25 09:26:13 CET]

Great job!
Thanks!
#5 - Mikkel Kristiansen [2010-11-28 12:32:18 CET]

Finally I'm somewhat able to use Dropbox on my arm-server! Thanks a lot!
/Mikkel
#6 - magne [2010-12-30 11:27:38 CET]

This is great! I just wish there was a way of doing this without relying on regex(what if they suddenly changes the site), and without storing my dropbox password in clear text.
#7 - Miles [2011-01-11 03:24:18 CET]

This is perfect, except it stumbles on folders with spaces, even when enclosed with quotations.
#8 - bram [2011-01-18 16:59:09 CET]

Great script! Do you think it is also possible to make a download or sync script in BASH? I want do download file or sync files from dropbox to a server without using FTP.
#9 - seventh [2011-01-22 20:49:18 CET]

Give us RSS or e-mail alert when new versions published
#10 - Michael Hart [2011-02-06 09:28:51 CET]

For anyone getting "Failed" when uploading, maybe this will save you some time :)

Max file size: 300MB.
#11 - bng44270 [2011-02-23 22:48:33 CET]

Using this in conjunction with tar to backup my /etc and /var/www folders to dropbox. LOVE IT!!!!
#12 - Alex [2011-03-09 18:22:40 CET]

Good work, man! Nice script.

But can you modify this script to receive public url of uploaded files? It would be perfect!
#13 - andi [2011-03-19 23:41:44 CET]

happily using it, thanks for sharing!!
#14 - Mike Redd [2011-03-20 20:37:42 CET]

Letting you know I've made an Arch Linux pkgbuild for script.
Hope you do not mind, I really enjoy using it.
http://aur.archlinux.org/packages.php?ID=45309
#15 - _b1 [2011-04-02 12:11:46 CET]

please, put it to github!
#16 - gward [2011-04-12 18:50:52 CET]

Great script. Upload works great. Now I need to be able to delete files in my Dropbox from the script. I run a automated script to upload the latest file by date and delete the old files I am backing up.
#17 - timendum [2011-05-26 10:03:41 CET]

Thanks!
#18 - none [2011-06-19 16:16:15 CET]

Thank you for the great script! Please add an option to limit upload speed, used in shared bandwidth network.
#19 - Davide [2011-07-14 12:27:48 CET]

spettacolare...
#20 - Lemur [2011-08-06 08:11:36 CET]

Very nice script, thank you for your good work!

Are you know also the "curl -line" to remove files and rekursive folders on dropbox-side, after the script logged in?

I would need this to remove my old backups...

Thanks
Lemur
#21 - José Lopes [2011-09-28 16:27:13 CET]

I created a Shell Script which uses your excelent BASH Dropbox Uploader to sync my webserver's backup with Dropbox. I call it Weback -- https://bitbucket.org/joselopes/weback

Unfortunatelly, according to [1], Dropbox refuses files with more than 300 MB. To upload such files, we need to use their default uploader.

[1] http://www.dropbox.com/developers/docs
#22 - Carlos Rendon [2011-11-17 22:09:12 CET]

What an excellent and useful piece of code. Thank you very much!!!
#23 - Uddhava [2011-12-11 17:20:22 CET]

Love this script!.
I do get some curl (timeout?) errors when i upload a 150-250MB file.
For example:
curl: (52) Empty reply from server
+ grep 'HTTP/1.1 302 FOUND' /tmp/du_resp_debug

This does not happen with a 100mb file.
Any ideas ?
#24 - Niklas Rother [2011-12-22 18:26:21 CET]

Hey, I really like your script, I'd like to use it to save some Backups. But these are too big: 500MB each file.
I tried to add an option to split files, that are to big and upload them in parts, but I failed ;)
It would be great, if you could help me!
#25 - Eugene [2012-03-01 05:45:57 CET]

Thanks a lot! Works good. One minor issue: Does not work under cygwin as is because home dir path can contain spaces. So config file has to be stored somewhere else for cygwin.
#26 - Carrot Cruncher [2012-04-03 16:51:36 CET]

great script. not sure if this is a limitation of the api but, could this script be enhanced to recursively upload and download directories/folders ? cheers.
#27 - Carlos Herrera [2012-04-18 18:43:55 CET]

Excellent, thats a good script! keep it up!
#28 - suda [2012-05-01 05:27:46 CET]

Thank you very much, Im agree with #26, it will be better if restore or sync the folders.
#29 - Shouvik Mukherjee [2012-05-18 20:19:06 CET]

Thank you very much! Such an awesome script!
I actually made a bit of modification to automate the task via crontab. Now for some reason this script doesn't work with my cronjob ... could you please help me out a bit?
#30 - Devich [2012-05-26 09:56:34 CET]

Excellent! Thank you very much!
#31 - Forcie [2012-06-11 13:07:06 CET]

I love it!
What would be awesome for me now would be a 'list command' allowing to list the content of a folder, and being able to download a whole folder (doesn't have to be recursive at first).
Thx =D
#32 - riyelpicture [2012-06-14 09:35:35 CET]

love this script! thanks..<br/><br/>BTW what if We want to upload multiple files with this script? it would be nice if this uploader could handle multiple files as an option..<br/><br/>but as for now, I try this solution and it works: write a script that will list (ls) all of my files within certain location and We can combine it with the power of grep and output the results to some temp file. We could then read the lines and execute the dropbox uploader script for every lines (filenames)..
#33 - Ben King [2012-06-28 19:15:11 CET]

It would be nice to see some errors results built into the script for files that are over the maximum 150GB API limit. I had a heck of a time debugging the script operation until I found this out.
#34 - Dylan Hall [2012-07-04 07:42:06 CET]

This would completely solve my problem if it could just download the contents of a folder.. love your work however, this is the closest I've come so far!
#35 - Jean [2012-07-04 22:51:08 CET]

Hi guys,

Thx a lot for this script : I'll use it to upload video taken by my home made security system to my DropBox.
Does anyone know if some DropBox FUSE project is mature enough to be used to upload videos directly on DropBox using a DropBox file system ?

Many thanks for any kind of reply on this subject :-)
Jean
#36 - daraeman [2012-07-31 08:12:14 CET]

Thanks for the script! Just stumbled upon this and I\'ll definitely be using it in the future.
#37 - Alex [2012-08-10 11:54:04 CET]

Thanks :)
#38 - Andrea Cortopassi [2012-08-10 21:40:23 CET]

Grazie mille per lo script, funziona davvero bene. Per il limite dei 150 mb ho risolto facilmente zippando i files con lo split in automatico, per fare quello che mi serve va + che bene.
#39 - JohnO [2012-08-17 22:05:50 CET]

Magnificently simple and effective. There is an list command that isn\'t yet full described. The list command has some problems with it. Well done Andrea my ARM devices can join the cloud.
#40 - Paulo Raponi [2012-09-06 20:20:19 CET]

Hi,

Great script. I don't know if it's possible, but can the script send a mail when some error happen? We are with an issue that when the dropbox account is full, the upload stop to send. I can receive a mail if this happen?
#41 - Timido [2012-09-11 13:12:35 CET]

@Paolo Raponi
I would suggest to not mix functions inside this script.
For sending emails, I would make a "master" script which in turn calls this script to upload to dropbox and then calls email command (eg: sendmail, or whichever script) to send the email in case of error (on the basis of exit code of this script).
#42 - Andrea [2012-09-11 13:35:17 CET]

I agree with Timido :)
#43 - Andy [2012-09-17 15:56:30 CET]

yes, Great script. I used it several months, but it can not upload folder now, can ipload one file only. can you tell me how to upload folder?
#44 - Andrea [2012-09-17 17:55:20 CET]

I'm not sure i add this functionality to Dropbox Uploader, but in the meantime you can use this simple script:

for i in $(find myLocalDir/ -type f); do ./dropbox_uploader.sh upload $i $i; done;
#45 - Andy [2012-09-18 16:41:16 CET]

Yes, it work well, thank you very much. I would suggest to add this function on next version.
#46 - B [2012-09-18 20:25:00 CET]

Why not use this?

https://www.dropbox.com/developers/reference/api#chunked-upload

#47 - Andrea [2012-09-20 17:45:58 CET]

@B

Is in the roadmap.
#48 - heylinux.com [2012-09-20 19:00:36 CET]

Thank you very much!!!!
This script is awesome! I'm using it to backup my VPS.
It's very kind of you to keep updating this script.
#49 - Chris [2012-09-27 02:38:59 CET]

Thanx. This was very helpful!

If I want to be able to run the script from anywere without being in the Dropbox-Upload directory. How do I do that?? Add: export PATH=$PATH:/new/path where?

Kind Regards
#50 - Steve [2012-10-05 11:56:03 CET]

Andrea, thanks for this script: it was just what I needed. I wanted to let you know of a change I made to my local copy, and to ask a question.<br/><br/>First, the change: when I registered the app with dropbox I chose to give it access to just a single folder (because I\'d installed this script on a server I don\'t fully trust). To make this work, I modified these three URLs to replace \"dropbox\" with \"sandbox\":<br/><br/>API_CHUNKED_UPLOAD_COMMIT_URL=\"https://api-content.dropbox.com/1/commit_chunked_upload/sandbox\"<br/>API_DOWNLOAD_URL=\"https://api-content.dropbox.com/1/files/sandbox\"<br/>API_METADATA_URL=\"https://api.dropbox.com/1/metadata/sandbox\"<br/><br/>That might be something you could include as an option; if not, it might be helpful for others.<br/><br/>Second, the query: I tried running the script as a cron job but it had no effect. I\'m going to enable DEBUG to see if I can figure out what\'s happening; my wild guess was that maybe the config file wasn\'t found when run by cron, but I don\'t really know.<br/><br/>Anyway, thanks for the script. :-)<br/><br/>Cheers,<br/>Steve<br/>
#51 - Andrea [2012-10-05 12:00:39 CET]

@Steve

Thanks for your suggestion.

Try to change the default config file path with the absolute path (/home/user/.dropbox_uploader).

Andrea
#52 - Steve [2012-10-07 10:14:09 CET]

Follow-up to my cron problem: this was my fault! The script was fine. My cron line involve percent-signs, which crontab translates to line breaks; I escaped them and all is well. False alarm. :-)

Thanks again,
Steve

PS Apologies for the formatting of my previous comment. I had to re-enter the security code and the text in the comment box had been replaced with HTML.
#53 - John [2012-10-08 05:52:53 CET]

Great job, thanks for this!

Could you also please implement the move command?
#54 - Marco [2012-10-10 11:59:44 CET]

Great script! use it all the time!

Now I want to use it on OpenWrt. Had to replace stat by &quot;wc -c&quot; but still run into &quot;An error occurred requesting /commit_chunked_upload&quot;.
U have any idea why this is?
#55 - asd [2012-10-11 10:42:20 CET]

Thanks, nice script. Keep life simple ;)
#56 - PengYu [2012-10-11 16:44:09 CET]

For non-English files, we should encode/decode the file name to UFT-8 first, use convmv or other command.

eg:
convmv -f gb2312 -t utf-8 --notest 测试.zip
#57 - Ronnie [2012-10-11 23:33:35 CET]

@Marco I had the same problem. The cause is the incompatibility of the &quot;sed&quot; version of busybox. The solution was simple:
- install sed (opkg update; opkg install sed)
- edit the script, replace &quot;sed&quot; with &quot;/usr/bin/sed&quot;
#58 - Alex [2012-10-18 02:24:36 CET]

Chunk upload not working in freebsd 8.3. please fix it :(
#59 - cufre [2012-10-19 11:49:24 CET]

Sto testando lo script con Zeroshell, ho dovuto aggiungere il parametro -k al comando curl per completar e il setup. il dowload funziona mentre in upload stesso problema di Alex &quot;An error occurred requesting /commit_chunked_upload&quot;
Se qualcuno avesse suggerimenti.. grazie ad Andrea per lo script
#60 - cufre [2012-10-19 18:40:08 CET]

usando la versione precedente dello script (senza i chunk files) funziona anche l'upload..Olè
#61 - Andreas [2012-10-23 19:34:31 CET]

Unfortunately, I still do not understand the function. I tried on Windows 7:
curl dropbox_uploader.sh info
But that does not work:
curl: (6) Could not resolve host: C; Host not found
Could you please help?
#62 - Florian [2012-10-24 06:45:57 CET]

Great script! Thank you!
#63 - monete [2012-11-01 12:21:39 CET]

Works like a charm!

Thank you for developing this useful tool. You are a hope for the Raspberry Pi users looking for a Dropbox oficial release substitute.

Complimenti and keep it up! ;)
#64 - Alex [2012-11-05 18:24:43 CET]

Thank you very much! Very usefull script. Work good on FreeBSD 8.3 but can't work as cron job :(
#65 - Elko [2012-11-05 20:39:38 CET]

Hey Andrea,

thank you very much for your awesome work. Uploading my stuff right now from my Raspberry Pi.

Can you tell me how to use the recursive upload function which was implemented since v0.5? I used your workaround (for i etc.) but I assume this might be just a temporarily solution.

Thanks in advance.

Regards Elko
#66 - Pau [2012-11-25 14:33:41 CET]

Hello,

I downloaded the script yesterday and wanted to use it to download all the contents of my dropbox to my linux-based NAS.

Since I couldn't find the option, I modified the script to be able to recursively download folders.

Here it is.

https://www.dropbox.com/s/yroz3hisj24p6j0/dropbox_uploader.sh

thank you.
#67 - dddesign [2012-12-03 23:57:47 CET]

hi,
great script, I use it on my openwrt-box.
1. I'm not shure if I can replace &quot;stat&quot; with &quot;wc -c&quot;, but anyway, I need the script for downloading
2. I use Pau's (comment #66) script with the &quot;sync&quot; command, great.
but now two questions:
A. how can I adapt the script that I can give a destination folder for &quot;sync&quot; (=download) all folders and files? I need this because I want to add it as a cron job. or is there another possiblity?
B. how can I adapt the script that it's &quot;sync&quot; (=download) only files and folders not existing in my destination folder?
@pau: any chance that you adapt your script with my requirements?
thanks a lot in advance
#68 - Tim [2012-12-07 17:23:02 CET]

Excellent Scrip!... but I think I may have found a bug...?

Create a file simply called &quot; H&quot; on the dropbox. (That's a space, followed by a capital H)

Then execute the following:

/bin/bash /home/pi/gframe/dropbox_uploader.sh download &quot; H&quot;
This returns with a &quot;FAILED&quot; error.

It appears to only be an issue with a CAPITAL letter H preceded by a space.

Other than that though, it appears to work really well and is a godsend on platforms like the Raspberry pi which don't support the official dropbox client.

Feel free to contact me if you have any questions.
#69 - Gordon Schulz [2012-12-12 09:24:39 CET]

Awesome script, thanks a lot for your great work.
#70 - Geert [2012-12-30 18:53:16 CET]

Works great. Using it on Centos 6.3 and on a hacked Pandigital 6&quot; eReader.
#71 - Marceau [2012-12-31 16:58:03 CET]

Pretty nice.

Thanks for making this and putting it up.
#72 - Diego [2013-01-10 01:29:57 CET]

Hello, I want to use your script, but when trying to download it I receive:
There aren't any uploads for this repository.

Please upload it, thanks a lot!

by the way, can I use it with a cronjob configured on my hosting?
#73 - Andrea [2013-01-10 11:07:19 CET]

@Diego: i have fixed the link, thanks.
Yes, you can schedule the script using crontab.
#74 - Mark [2013-01-20 04:57:17 CET]

root@moon:~# ./dropbox_uploader.sh
: No such file or directory

how is that possible? The file exists and is executable!
#75 - Matthew Manning [2013-01-30 13:04:31 CET]

This is great. But it's not really dropbox. It doesn't allow you to automatically cron and therefore upload files to drop box.

It's all a little manual. It would be great to have it work more like drop box
#76 - VDIAS [2013-02-07 11:06:34 CET]

How can i upload a entire directory?

#77 - Ray K [2013-02-08 02:12:46 CET]

Super awesome!! Thanks a ton for this! Will transition this from my Ubuntu system to my Raspberry pi when I have it take over these kinds of functions!
#78 - frogfire [2013-02-14 10:10:44 CET]

Thank you soooooooooooooooooooooooooooooooooooooooo much!! You made my day
#79 - Janine [2013-02-16 13:36:29 CET]

Great script! Thans a lot. I use it for sending weekly my backup-files of the databases and home pages to my dropbox. And it is so easy to use :-)
#80 - Ashish [2013-02-21 16:59:30 CET]

Awesome script! Works like a charm. Just what I needed to upload some files to my DropBox account from my Raspberry Pi.

Thanks a lot!
#81 - Raspberry [2013-02-26 14:51:44 CET]

You are my Hero !!!!1
#82 - TrappedInSide [2013-03-07 18:47:56 CET]

Thanks for the hard work.
#83 - Dan Hvidding [2013-03-13 16:50:23 CET]

This script is awesome. Really helped me get a large file out from a place with a crappy network connection. Thanks for sharing!!
#84 - Martin [2013-03-20 09:48:50 CET]

Thank you! I've used this to upload images from my Raspberry Pi &quot;security&quot;-cam. It worked right away, and exceeded my expectations.
#85 - Hide74 [2013-03-23 12:38:34 CET]

Thank you for great script!
I tried to use it with busybox by splitting each function into a scripts and small modifications. Now, I can run this on DD-WRT without bash.
#86 - Beakid [2013-03-28 08:16:22 CET]

Hi! Thanks for an awesome script.

Is it possible to execute the script from a php-file online? I have tried executing it with:

$output = shell_exec('sh /usr/home/dropbox_uploader.sh upload test.txt');
echo $output;

But I keep getting &quot;Error: this script requires BASH shell!&quot;. I tried uncommenting that bash-check in the script, but it won't work nevertheless. I have also tried executing it as a background process but without luck.

Anyone? :)
#87 - shiedman [2013-04-16 10:13:23 CET]

great job,man!
#88 - openwrt [2013-04-28 14:29:34 CET]

will be usefull! thank you
#89 - Kayr [2013-04-30 12:33:25 CET]

Nicee!!!
#90 - Fred [2013-05-02 01:25:19 CET]

Very useful,

Thank you!
#91 - minimoto [2013-05-08 20:04:47 CET]

Thank you for your hardwork and I am able to run your script. Only thing I am having is when I try to send mysqldump file to dropbox, URLencoding force file name to change to generic urlencode name. Is there way to keep original xxx.sql file name?
#92 - Alexandre Santos [2013-05-10 00:42:39 CET]

Awesome work. I can finally fine tune my backups with DropBox :)
#93 - moose [2013-05-15 07:55:52 CET]

Thank you so much! Amazing work, really helpful. I have a quick question/request
Is there a way to download all files in a folder at once?
#94 - Hugh [2013-05-16 15:23:42 CET]

Brilliant! Just what I needed!
#95 - Javier [2013-05-21 23:33:04 CET]

Great script, I just downloaded it and started using it to backup my website.
Unfortunately my hosting company (godaddy) provides a version of &quot;curl&quot; that does not support the option --data-urlencode. Could you suggest any workaround? Thanks ;-)
#96 - blogmywiki [2013-05-25 11:21:21 CET]

Fantastic script, thank you so much Andrea. I have it running on my RaspberryPi - found it very easy to set up. I'd also like to know if there's a way of downloading all files from a Dropbox folder without knowing their names?
#97 - Andrea [2013-05-28 15:57:16 CET]

Fixed problems with --data-urlencode.

Andrea
#98 - Giancarlo [2013-06-03 15:51:58 CET]

Hi, I love your script, I have a simple request:

Can you enable wildcards so I can sync an entiere folder between my working copy and dropbox ?
#99 - jens [2013-06-10 23:35:20 CET]

Worked perfect very easy usage self explaning, good job.
#100 - Panos [2013-06-17 09:47:16 CET]

Great script! Thank you so much for creating and maintaining it!

I would like to second that request from &quot;Giancarlo&quot; above for wildcards if possible.
#101 - OlgaMaria [2013-06-28 01:34:57 CET]

This is exactly what I've been looking for. Thanks! :)
#102 - Geoff Lane [2013-07-03 15:24:04 CET]

Brilliant utility but I'd love to know how to resume an upload after a failure. So annoying when a video upload fails near the end.
#103 - Skillsy [2013-07-07 15:53:38 CET]

What a fantastic script and thank you for the time and effort developing. Works excellently under cygwin if you install CURL and was a way to get the required tokens and move the resulting config file to our production environment (that prevents direct web browser access).


#104 - Greyson [2013-07-10 03:33:38 CET]

Fantastic script, thank you!

I have on request (if it is even possible):
Can the script be modified to check if a file is different from the one on dropbox, so that it doesn't upload every file in a directory every time? Syncing takes some time for my large folders and it would be hugely time-saving if this could happen.

Thanks again!
#105 - f0ruD [2013-07-12 17:40:11 CET]

Thanks for this great script.

I create an AUR package for archlinux here : https://aur.archlinux.org/packages/dropbox-uploader-git/
#106 - Vince [2013-08-09 10:14:05 CET]

very nice, great example of how to utilise the DB api, have alread added to your excellent script

dropbox-uploader longlist / -h
&gt; Listing &quot;/&quot;... DONE
[D] Mon 05 Aug 2013 01:07 --- bin
[D] Sat 27 Jul 2013 23:30 --- Documents
[D] Thu 01 Aug 2013 08:48 --- emu_working
[D] Tue 30 Jul 2013 06:37 --- emulator
[D] Sat 27 Jul 2013 23:24 --- Pictures
[D] Tue 30 Jul 2013 06:37 --- src
[D] Mon 05 Aug 2013 01:07 --- uqlx-py
[D] Tue 30 Jul 2013 06:37 --- Videos
[F] Thu 03 Jan 2013 13:38 243.3 KB Getting Started.pdf
#107 - CA [2013-08-10 10:35:25 CET]

Great script, is there a way to make it ignore files that already exist on the target and just upload/download the deltas?

Cheers
#108 - marttt [2013-08-11 17:08:40 CET]

Thank you very much for this. Precisely what I needed.
#109 - Chris [2013-08-12 17:08:21 CET]

Is there any way to preserve the server timestamp of the downloaded files?

Cheers
#110 - ryzhov_al [2013-08-29 08:45:46 CET]

Dropbox Uploader included into Entware repo for MIPSEL routers. Works well. Thank you!
#111 - MegaV0lt [2013-09-08 12:00:39 CET]

Thank you for the script! It made my day!
#112 - Masamiti [2013-09-16 07:57:02 CET]

Thank you for the script, but I found a dug in the script when I tried to download nested directories.
The bug happen because variable $DEST_DIR is overwritten incorrectly.
So line 602 in code (function db_download)

DEST_DIR=$(normalize_path &quot;$DST/$basedir&quot;)
--&gt;
local DEST_DIR=$(normalize_path &quot;$DST/$basedir&quot;)

then,OK
#113 - Andrea [2013-09-16 09:54:03 CET]

Thanks Masamiti,
bug fixed.
#114 - Giuseppe [2013-09-26 11:49:24 CET]

Ottimo, utilizzato su Raspberry senza nessun problema.

Saluti.

G.
#115 - Arie0510 [2013-10-16 16:21:36 CET]

Hi,
Thanks for your script. When i tried to run it on my sparc linux machine, I received the following error:


./dropbox_uploader.sh: line 279: conditional binary operator expected
./dropbox_uploader.sh: line 279: syntax error near `=~'
./dropbox_uploader.sh: line 279: ` if [[ $ERROR_MSG =~ .*access.attempt.failed.because.this.app.is.not.configured.to.have.* ]]; then'


This is due to the fact that I use bash 2.05b, i.e. an old bash before bash 3. Therefore the =~ operator can not be used. I believe the following code achieves the same


case $ERROR_MSG in .*access.attempt.failed.because.this.app.is.not.configured.to.have.* )
echo -e &quot;\nError: The Permission type/Access level configured doesn't match the DropBox App settings!\nPlease ru
exit 1
esac

but does not use the =~ operator and therefore makes the script work in older bash-versions too.

#116 - Andrea [2013-10-17 09:06:33 CET]

Thanks Arie0510,
I've fixed the problem with the last commit.
#117 - Arie0510 [2013-10-17 13:23:11 CET]

Hi Andrea,
I am trying to get your script running on my Readynas NV+ (sparc). That NAS has this old bash-version I mentioned in my previous post. But also some other issues:
1) For printf the option -v is not recognized
2) The syntax += is not recognized
3) The shell option nocasematch is not recognized.

I fixed these issues in the following way:


MODIFICATION 1: I changed line 302 from
* ) printf -v o '%%%02x' &quot;'$c&quot;
into
* ) o=`printf '%%%02x' &quot;'$c&quot;`

MODIFICATION 2: I changed line 304 from
encoded+=&quot;${o}&quot;
into
encoded=$encoded&quot;${o}&quot;

MODIFICATION 3A: I changed line 409 from
basefile_dst=$(basename &quot;$FILE_DST&quot;)
into
basefile_dst=$(basename &quot;$FILE_DST&quot; | tr '[:upper:]' '[:lower:]')

MODIFICATION 3B: I removed lines 406 and 421, i.e. the lines
shopt -s nocasematch
and
shopt -u nocasematch

Note that MODIFICATION 3A introduces additional dependency on tr, causing a change in line 60 where BIN_DEPS is defined. Alternatively you can use sed instead of tr for MODIFICATION 3A.

Using the above changes (including the one in the earlier post) I have so far been able to complete the setup on my Readynas, and alos I managed to upload files to my Dropbox account.

I'll now continue testing your script for the other options (other than 'download'), and let you know the outcome.
#118 - Greg [2013-10-21 14:47:25 CET]

Is there anyway that a option can be added to auto delete files on drop box that are older than x days. I think this would be really useful.
#119 - Alejandro [2013-11-08 15:51:11 CET]

Hi,

This is a god tool. I have recently used it with openwrt to upload videos from my web cams to dropbox.

Although i am experimenting some problems with list parameter.

I have a remote directory but it seems that I can't list directories with more than 31 elements (files or sub-directories). The error showed is:

Listing &quot;/DIRGAN_HOME_SERVER/VIDEOS&quot;... FAILED: /DIRGAN_HOME_SERVER/VIDEOS is not a directory!

Any suggestion?

#120 - sunsina [2013-11-18 15:35:55 CET]

Hi,
I could not manage to make the script work on LININO flavor of
OpenWrt which comes with Arduino Yun.
I just copied the dropbox_uplader.sh into /usr/bin and execute '#dropbox_uploader.sh' as root and I got following error:

Does any body knows how can I fix the problem?
Error: Required program could not be found: stat
#121 - sunsina [2013-11-18 16:02:14 CET]

Ok,I figure out what was missed
the package name is coreutils-stat I just installed it to give it a try
#122 - sunsina [2013-11-18 23:55:21 CET]

Another problem with OpenWrt(LININO Arduino Yun).
I get following error:
Error: cURL is not able to performs peer SSL certificate verification.
Please, install the default ca-certificates bundle.
To do this in a Debian/Ubuntu based system, try:
sudo apt-get install ca-certificates

It seems there is no equivalent in opkg such as &quot;opkg install ca-certificates&quot;
I do not know how can I attack the problem and how to obtain and where to store the DropBox certificate.
Any help will be appreciated
Thanks

It seems that I have to install
#123 - Andrea [2013-11-20 17:01:24 CET]

I think that you have to install the CA bundle manually.
Otherwise you can try the Dropbox Uploader -k option, it's insecure but it should works...
#124 - Salomon [2013-11-21 13:31:29 CET]

Perfect, it worked for my 'digital picture frame' with the first go.
Thanks a lot
#125 - Paul Dev [2013-11-28 22:36:29 CET]

Excellent - perfect solution!
#126 - BYQ [2013-12-09 10:24:23 CET]

Hi, excellent script. Is there a way to have multiple instances of this script on single machine? (like different names of script file for different dropbox accounts, of course with different config files). I tried to do it, but ended with:
$ ./db01.sh list
&gt; Listing &quot;/&quot;...
Error: The Permission type/Access level configured doesn't match the DropBox App settings!
Please run &quot;./db01.sh unlink&quot; and try again.
What's weird - the same script executed with 'info' parameter seems to display correct data about dropbox account (name, email, quota, etc)
#127 - Andrea [2013-12-09 17:36:34 CET]

Hello BYQ,
you can use the -f option to specify different configuration file.

If you get that error message, it means that the script is not configured correctly.
#128 - Alessandro [2013-12-18 10:39:43 CET]

Thank you very much for the script!
A question: when use the download option there is a way to overwrite existing local files only when the content is different? Now there is only the -s option, but the check is only for the file name.
Thank you
#129 - JPhil [2014-02-18 10:48:45 CET]

Hi
This is an excellent script :-)
It's just I'am looking for and exactly what I needed.
I have just one question :
- How to create 2 API keys for upload to Dropbox @ gmail and Dropbox @ another. I would like to send some file into one or another account with my script.

Thanks Great job!

Best Regards
#130 - Andrea [2014-02-18 15:08:19 CET]

@JPhil
You can use the -f option, to specify a different configuration file.
#131 - JPhil [2014-02-19 21:48:05 CET]

@Andrea

* Thanks, in fact it was the same query than #126 and #127. Sorry .
But I don't understand where is my configuration file ?
It's the Provide app name wich give me the app name folder ?

Best Regards.
#132 - Andrea [2014-02-20 09:00:59 CET]

@JPhil
You can use the configuration file name you want, eg:
./dropbox_uploader.sh -f ~/.conf1
./dropbox_uploader.sh -f ~/.conf2
./dropbox_uploader.sh -f ~/.conf3
#133 - Emanuele [2014-02-21 14:14:30 CET]

Very nice !

I noticed that after downloading timestamps are not preserved, is there a way to set this option ?

Thank you.
#134 - JPhil [2014-02-23 17:02:05 CET]

@Andrea

Thanks for your help.

Best Regards
#135 - Guillermo [2014-02-25 19:57:40 CET]

Hey, excellent job, thanks for sharing.
#136 - Andrew [2014-03-05 03:21:47 CET]

You, hacker! great job. Thank you
#137 - TA [2014-04-02 20:33:31 CET]

Great work man!
I finally got it working. I had a &quot;SYNTAX&quot; issue on line 764. Quotes missing.
#138 - TJ [2014-04-03 17:37:26 CET]

Excellent job!
Now, I cannot get pass the server proxy.
Win:
set HTTP_PROXY_USER=blahbblha
set HTTP_PROXY_PASSWORD=blah
set https_proxy=blew

Error: Couldn't connect to host.

help please.
#139 - Johnson [2014-04-07 21:31:04 CET]

Can this be used in a x64 bit machine?
I am having the following problems,
'shopt' command not found,
' [[ ' command not found

Please I need help with this. Thx
#140 - HugoC [2014-04-09 15:53:29 CET]

Been looking for a drobpox official client substitute for a LONG time. Mainly for backups of my home servers and various stuff, too.

This script works great on Debian Wheezy, both on x86 and various ARM-based sticks.

Thanks for your efforts!
#141 - GRoston [2014-04-21 06:24:21 CET]

Andrea,

Thanks for making this super useful script available.

I just installed it on my shared host (Red Hat 4.4.7-3, based on kernel 2.6.32-379.22.1.lve1.2.14.el6.x86_64). The script installed without any problems, but it does not behave properly. Specifically, when I enter the command:

./dropbox_uploader.sh upload &lt;filename&gt;

the script prints its usage and does not upload the file. When I enter the command:

./dropbox_uploader.sh upload &lt;filename&gt; &lt;filename&gt;

the script does copy the file to dropbox. The problem is that I can to create a cron job to upload a file whose name will change very day, thus the latter form does not help.

Could you please suggest how I can fix this problem.

Gratzi!
#142 - Andrea [2014-04-23 13:46:38 CET]

GRoston, you have to specify the destination file/directory. So:
./dropbox_uploader.sh upload filename /

Please take a look to the README file.
#143 - Enrico [2014-04-29 09:23:15 CET]

Dear Andrea,
Complimenti per l'ottimo lavoro!
I've been using it for a while without any problems as a cronjob on a QNAP NAS.
After restarting the NAS I had to re-authorize the app on my Dropbox, but this was not a big problem.
The real problem I've encountered, tried to debug myself but cannot get past, is this:

&quot;Error: Required program could not be found: printf&quot;

I get it into the cronjob log every time it tries to launch dropbox_uploader.sh ...
The strange thing is that if I try to run it manually, it works like a charm! (both as a user both as a super-user).

What could it be?

Grazie

Enrico
#144 - Andrea [2014-04-29 10:54:35 CET]

Ciao Enrico,
can you open an issue on github please?
#145 - kapsh [2014-07-16 04:16:43 CET]

This is fucking brilliant! Thank you for the great solution for db.
#146 - Dean Bayley [2014-07-24 15:21:08 CET]

Love the script, implemented into my daily backup script replacing FTP, worked fine when i was manually launching the backup.sh it ran perfectly but when cron ran the script it kept saying no such file or directory.

I thought it wasn't passing the arugments propperly but it turned out it was the shell saying it could't find the script.

Turns out all i needed to change was the way i called the script:

### FROM ###

./dropbox_uploader.sh upload &quot;/home/complete_backup_$NOW.tar.gz&quot; &quot;/$YEAR/$MONTH/$DAY/complete_backup_$NOW.tar.gz&quot;

### TO ###

source /home/scripts/dropbox_uploader.sh upload &quot;/home/complete_backup_$NOW.tar.gz&quot; &quot;/$YEAR/$MONTH/$DAY/complete_backup_$NOW.tar.gz&quot;

Name:
Email: (Will not appear online)
Comment:
Security Code: