Luciano Rocha wrote:
On Tue, Aug 07, 2007 at 05:13:11AM -0600, Karl Larsen wrote:
I am interested in why you keep the last 15 incremental
backups in files away from the main backup.
Why or how? If "why", because I may only notice that I deleted an
important file or e-mail after a few days. With the backup, I can still
access them.
Got it! And very smart! Why not have a protection from accidental
deletion. After all a unix delete is a real delete!
If "how", I iterate over the contents of the directory and keep
variables with the number of entries in the directory and the argument
to rsync with the link-dest option:
for d in `ls $host/`; do
if [ $count -gt 15 ]; then
## remove if more than 15
rm -fr $host/$d
elif [ $count -le 2 ]; then
## add to link-dest if lower/eq than 2
link="--link-dest=$PWD/$host/$d $link"
fi
((count--))
done
--
Karl F. Larsen, AKA K5DI
Linux User
#450462 http://counter.li.org.