A shellscript that makes marvelous incremental backups
Usage: ge_backup.sh /some/folder/ my_backup
#!/bin/bash
if [ $# -ne 2 ]
then
echo
echo "incremental backup"
echo "usage: ge_backup.sh "
echo "example: ge_backup.sh /some/where/data/ backup"
echo
exit 1
fi
rsync --delete \
-avu \
--backup \
--backup-dir=$(pwd)/$2.history/$(date +%Y-%m-%d-%H-%M-%S) \
$1 \
$2 \
| tee -a $2.log
Characteristics of the backups:
2 Backupfolders:
data
data.history
You can rewind the contents of data by performing these 2 actions for every history-point:
1) Delete all files younger (linux command stat) then the history point
2) Copy all files from the history point back to the data folder
Known alternatives:
rdiff-backup - This is the way to go!
rdiff-backup does incremental backups not only on a file basis, but also on an "in file" basis that even works with binary files. So it keeps the history of each file in a very efficient way. It also has nice tools compare, recreate etc.
git - The version control system
Might be worth a try. But at the moment git doesnt track empty directories (see http://kerneltrap.org/mailarchive/git/2007/7/17/251902)