Hello,

> I was looking at this rotating backup script
> 
> source:
> https://community.spiceworks.com/topic/34970-how-to-create-rotating-backups-of-files
> 
> ----------backup script----------------
> BACKUPDIR=`date +%A`
> OPTS="--force --ignore-errors --delete-excluded --exclude-from=$EXCLUDES 
>       --delete --backup --backup-dir=/$BACKUPDIR -a"
> 
> export PATH=$PATH:/bin:/usr/bin:/usr/local/bin
> 
> # the following line clears the last weeks incremental directory
> [ -d $HOME/emptydir ] || mkdir $HOME/emptydir
> rsync --delete -a $HOME/emptydir/ $BSERVER::$USER/$BACKUPDIR/
> rmdir $HOME/emptydir
> 
> # now the actual transfer
> rsync $OPTS $BDIR $BSERVER::$USER/current
> -------end backup script----------------
> 
> Can anybody explain why they they "...clear the last weeks incremental 
> directory"?

Probably because BACKUPDIR is set to the name of the day (`date +`A`).
Today is Tuesday and a backup is done, next week the backup will be
overwritten because BACKUPDIR will also be Tuesday. Therefore there will
only be 7 directories.

> Doesn't "rsync --deleate" option take take care of this?

--delete removes extraneous files. Combined with the previous thing, it
ensures the backup rotation.

> Does it have something to do with Windows? 

Hu? What is Windows? I do not know what are those alternative OSs ;)

Regards,

JC

Attachment: signature.asc
Description: PGP signature

Reply via email to