--exclude and --delete
lister at pyroboy.com.au
Wed Feb 25 22:56:33 GMT 2004
Wayne Davison wrote:
> On Wed, Feb 25, 2004 at 02:32:47PM +1100, andrew wrote:
>>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.
> I can't duplicate this. If I make /home/user/profile on the receiver a
> file (instead of a directory) it will vanish (because the trailing slash
> on the exclude tells rsync only to exclude a directory by that name),
> but if it's a directory, it remains unaffected.
OK, I think I've worked out what the problem is.
Because the profile directory was never rsync'd (it was created
independently on both the sender and the receiver) rsync didn't like it
and deleted it every time.
So, I deleted profile/ on the receiver and rsync'd from the sender
without the --exclude option. Now the profile directories on the sender
and receiver are the same.
Subsequent calls to rsync, with the --exclude and --delete options, now
behave as expected. profile/ is excluded from both the copy and the delete.
Is this the expected behaviour? Does rsync need to 'know' about a file
before it can handle it correctly?
More information about the rsync