Dropbox Maildir Backup

I made the following script:

#!/bin/bash

cd ~/Maildir/
for folder in .[a-zA-Z]*; do
  if [[ $folder =~ "SPAM" ]]; then
    echo "Skip"
  else
    echo -n "$folder.. "
    tar cjf ~/Dropbox/Mail/mailbak$folder.tar.bz2 --exclude='dovecot*' --exclude='courier*' $folder/
    echo "done"
  fi

done

This tars up each maildir (not including my inbox) and puts it in Dropbox. I don't really want to have a copy of them on my main computer, so I just quit the Dropbox program to stop them from being synchronised :) It is my hope that the binary diff thing means that updating the tar files doesn't suck. I'd previously tried to back up to the clouds using un-archived maildirs, and this tended to crash things because of the large number of tiny files involved.

The verdict? I'm not sure! I don't think the binary diff really worked well on this sort of archive. I will therefore therefore improve my script to split maildirs into a series of monthly files. This will have the classy bonus that I should only need to archive recently modified files.

The aftermath? I decided that it sucked. The better solution was to use tar's built-in diff function and Amazon S3's free 5 GB of storage. For this I wrote an Amazon S3 backup script.