Until you write your own, have a look at rdiff-backup. I use it writing to a drive in an eSATA enclosure (USB enclosures apparently tend to be garbage).
I've restored from rdiff-backup a couple of times. Once using the restore command, another time just going and grabbing the data from the backups directory because grabbing the most recent one was good enough.
I have this in /etc/cron.daily/rdiff-backup:
#!/bin/bash
BACKUP_DEST=/backups
RDIFF_PATH=/usr/bin/rdiff-backup
BACKUP_PATHS="/usr/local/cfengine /var/lib/cfengine2 /etc /var/home /igor"
for backup_path in ${BACKUP_PATHS}
do
DEST=${BACKUP_DEST}/`echo ${backup_path}| sed -e 's|^/||' -e 's|/|-|g'`
${RDIFF_PATH} ${backup_path} ${DEST}
${RDIFF_PATH} --remove-older-than 2W ${DEST} 2>/dev/null
done
Also, revision control! If you just want something to keep you from nuking things you want to keep, git is great, branching is cheap and easy. If you just want something dead-simple, RCS is dead simple:
mkdir RCS
ci -l code.c
> I'm about to try something stupid
> .
vim code.c
# Oh yeah, shit was bad
co -l code.c