Dropbox Uploader #bashscript with DB backup, Dropbox Upload, and Old File Deletion

I’ve got a couple of databases that I like to backup nightly and upload to my Dropbox. Key to this process is Andrea Fabrizi’s excellent Dropbox Uploader script. Dropbox Uploader is a BASH script that gives me Dropbox upload, download, list, and delete capabilities. Until now, the script I’ve used didn’t delete my old files in my Dropbox folder.

This week I’ve scripted cleanup inside my Dropbox folder. The way it works is by comparing the backup files on the server and then deleting any extra files inside my Dropbox. My code is below. If you have any suggestions for improving my script, please share them in the comments.

NOTE: My script assumes that you’ve moved dropbox_uploader inside a directory found in your $PATH (e.g. /usr/local/bin).