The wiki for Include/exclude Patterns includes the following:
Patterns may contain wildcard characters “" which matches a path string of any length, and “?” matches a single character. Note that both "” and “?” will match any character including the path separator “/”.
I believe the last sentence there may be what is tripping me up. My goal is to include the entire contents of my home dir recursively with one exception. I’d like to exclude the contents of each users’ TMP dir. The configuration I have been working with is as follows:
-home/*/TMP +home/ +home/*
However, this is not producing the desired results. I suspect that the ‘*’ is matching greedily and therefore effectively excluding all the contents of the home dir. Is this correct? The only option I see to work around this is to specifically list out each user’s TMP DIR as follows:
-home/userA/TMP -home/userB/TMP -home/userC/TMP # ... more users here +home/ +home/*
This feels brittle at best (what if I forget to edit the filters file when a new user is added). Is there a better approach?
Is it safe to say that you should never have a "*’ anywhere in an Include/Exclude pattern except for the final character? If so, perhaps any such occurrence should produce an error or warning message as it is unlikely to produce the desired results.