next up previous contents
Next: Watching if a user Up: More shell script examples Previous: Backing up your files   Contents

Backing up only files that have changed

The following script backs up only files that have changed in the last 15 minutes. It keeps the files from earlier backups and adds only the changed files.

#!/bin/bash
dir=$1
dir=$2
for d in $dir1 $dir2
do
    find "$d" -mmin +15 ! -type d -print  > "$d".list
    tar -cpf - -X "$d".list  "$d" | (cd backup; tar xf -)
    /bin/rm -f $d.list
done



Amit Jain 2006-11-20