--exclude and --delete
John Van Essen
vanes002 at umn.edu
Wed Feb 25 22:40:51 GMT 2004
On Thu, 26 Feb 2004, andrew <lister at pyroboy.com.au> wrote:
>
> Paul Slootman wrote:
>> On Wed 25 Feb 2004, 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.
>>
>>
>> Hmm, wouldn't the exclude need to be "/profile", as the exclude patterns
>> starting with / are anchored at the top of the source tree, ie.
>> /home/user ? Or am I confused about the exclude patterns again :)
>
> I'm pretty sure / refers to /home/... at least that's how it looks when
> using -v. In any case, the exclude is working OK for the copy, just not
> for the delete.
Since there is no trailing slash on '/home/user', the sender root is
at '/home/', so the exclude pattern is correct in that case.
But the receiver path is '/home', so the root for building the
exclude path is '/', and hence the exclude does not match on the
receiver since it's not looking under /home.
I'd suggest appending a '/' to 'user at receiver:/home'.
John
More information about the rsync
mailing list