--exclude and --delete

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


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.


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:

   This tells rsync to delete any files on the receiving side that 
   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,

More information about the rsync mailing list