--exclude and --delete

andrew
Wed, 25 Feb 2004 03:33:24 -0000

Hi,

I am experiencing a problem when using rsync (2.6.0) and I was after
some clarification.

I wish to sync two directories except for a specified sub-directory that
exists in both the sending and receiving directories.

So,

rsync -av --exclude "/user/profile/" --delete /home/user
user@receiver:/home

This works as I expect, sender:/home/user/profile/ is not copied, except
that receiver:/home/user/profile/ is deleted.

 From the manual:

--delete
   This tells rsync to delete any files on the receiving side that
aren't
   on the sending side. <fair enough>
   Files that are excluded from transfer are excluded from being
   deleted unless you use --delete-excluded. <!>

The directory sender:/home/user/profile/ IS successfully excluded from
the transfer and yet receiver:/home/user/profile/ still gets deleted.

Is my understanding that, if excluded from transfer, a directory should
not get deleted from the receiver correct?

Or, have I screwed up my command somewhere?

Many thanks,
...andrew