--backup-dir confusion

Dave Dykstra dwd at bell-labs.com
Thu Jan 3 09:38:59 EST 2002

On Sun, Dec 30, 2001 at 04:15:37AM -0500, Philip Mak wrote:
> With the following rsync settings:
> cd /home/lina_backup
> rsync -R -v -z -rlptgo --delete \
>   --password-file=password \
>   --include-from=include --exclude="*" \
>   --backup --backup-dir=./`date -d yesterday +%Y-%m-%d` \
>   rsync://root@lina/backup current
> I would expect the backup directory to be /home/lina_backup/2001-12-29.
> But it becomes /home/lina_backup/current/2001-12-29. Is this a bug? (Am I
> abusing the rsync command by trying to use relative paths and shouldn't do
> this?)

I'm pretty sure backup-dir is relative to the destination directory. 
If anybody confirms it for me, I'll change the man page.

> BTW, will my settings clobber a file if something goes wrong with the
> rsync? Or will the existance of the backup directory make certain that if
> the rsync doesn't work, it at least keeps the older copy of a file?

It should.  In general rsync always does all it's work in a temporary file
and only does a rename when it's all done so it never really completely loses
a file.

- Dave Dykstra

More information about the rsync mailing list