--exclude and --delete

andrew lister at pyroboy.com.au
Wed Feb 25 03:32:47 GMT 2004


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 at 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



More information about the rsync mailing list