Last October, I wrote an article explaining how one could use a small Perl wrapper with Dropbox Uploader to compress files and upload them to Dropbox (whoa – say that 10 times fast!) The wrapper was admittedly sloppy at the time. I’d only planned on using it for myself, but thought I’d share the idea incase someone wanted to make it better. Well, I got tired of waiting for someone to make it better, so I did it myself =).
Introducing Dropbox Uploader Compress. It uses Dropbox Uploader to do all of the interaction between Dropbox and your Linux server, but adds the abilty to compress the file (or folder) you’re uploading (tar / gzip), first. I’ve also added some other features that allow you to specify things like file paths, gzip file prefixes and destination folders by passing flags.
Usage: ./db_uploader_compress.pl [OPTIONS] Example: ./db_uploader_compress.pl --bu_source='foo' --bu_source_path='/home/bar/' --bu_target_folder='baz' --script_path='/usr/sbin/' --type='folder' --bu_source Required: Folder of file to back up. Do NOT use full paths or slashes. --bu_source_path Required: Path to --bu_source_file. --type Required: Source = folder or file. --bu_prefix Optional: Backed up file/folder filename prefix. (Defaults to 'default'). This is not applicable if the --nocompress flag is set. --bu_target_folder Optional: Folder on dropbox to back up to. --bu_staging_folder Optional: Folder to stage backkup file / folder (it gets compressed here & then gets removed after it's uploaded. Defaults to /tmp/.) --script_name Optional: Name of Dropbox Uploader shell script (defaults to dropbox_uploader.sh). --script_path Required: Path where dropbox_uploader.sh lives --tar Optional: Path to tar (defaults to /bin/tar). --rm Optional: Path to rm (defaults to /bin/rm). --nocompress Optional: Do not compress file (tar and gzip). Folders HAVE to be compressed! --help Optional: Display this message.
I’ve only tested on Ubuntu 12.04, but the only limitation should be Perl v5 and a server that has tar and rm installed. The entire project is open source under the GPLv3 license. Feel free to use, fork, and report bugs through the GitHub repo.
You can grab it HERE.