Fwd: Problem with file exclusion pattern

H agents at meddatainc.com
Sun May 1 15:30:42 UTC 2022


On 04/30/2022 09:13 PM, Kevin Korb via rsync wrote:
> Sure, that is the way it normally works.  By default everything is included.  Excludes exclude things.  Includes are exceptions to includes that follow.
>
> Note that this can get very complicated.  --exclude-from=file.txt makes things much easier as you can use the +/- syntax to put both includes and excludes into the same file.
>
> On 4/30/22 20:48, H via rsync wrote:
>> On 04/30/2022 08:22 PM, Kevin Korb via rsync wrote:
>>> Includes override excludes that follow.  So, your include of * meant that nothing was being excluded.  An exclude before any includes isn't affected by the includes.
>>>
>>> On 4/30/22 20:04, H via rsync wrote:
>>>> On 04/30/2022 07:56 PM, H via rsync wrote:
>>>>>
>>>>> Ah, I was under the impression that all inclusion patterns need to preceed the exclusion patterns?
>>>>>
>>>>>
>>>>>
>>>>> -------- Forwarded Message --------
>>>>> Subject:     Re: Problem with file exclusion pattern
>>>>> Date:     Sat, 30 Apr 2022 18:49:22 -0400
>>>>> From:     Kevin Korb <kmk at sanitarium.net>
>>>>> To:     H <agents at meddatainc.com>
>>>>>
>>>>>
>>>>>
>>>>> Drop the include of * or move the exclude of *.~lock* before it.  Also,
>>>>> -c is almost always a bad idea.
>>>>>
>>>>> On 4/30/22 18:18, H via rsync wrote:
>>>>>> I am running rsync on Linux and have yet to find the appropriate pattern to exclude files containing '.~lock' as part of the name of files existing in any directory, ie ~/test and below.
>>>>>>> rsync -vHrltDium -c --chmod=Du+rwx,go-rwx,Fu+rw,go-rw --no-perms --stats --include='*' --include='*/' --exclude='*.~lock*' --exclude='*' -e "ssh -y -p 22" ~/test/ someone at 1.2.3.4:~/test
>>>>>>> Can anyone point out what I have missed in the above?
>>>>>>> Thank you.
>>>>>>>
>>>>> -- 
>>>>> ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,
>>>>>      Kevin Korb            Phone:    (407) 252-6853
>>>>>      Systems Administrator        Internet:
>>>>>      FutureQuest, Inc.        Kevin at FutureQuest.net   (work)
>>>>>      Orlando, Florida        kmk at sanitarium.net  (personal)
>>>>>      Web page:            https://sanitarium.net/
>>>>>      PGP public key available on web site.
>>>>> ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,
>>>>>
>>>>>
>>>> When I dropped the '*' include it did not sync files in the topmost directory? Perhaps it always needs to be included among the options?
>>>>
>>>>
>>>
>> Thank you. Would one ever put an exclude /after/ the includes?
>>
>>
>
I did some more googling and now believe I may have a better understanding of include and exclude patterns, particularly that they are always evaluated in order.

Thank you for your help.




More information about the rsync mailing list