Glob documentation (I'll refer to it):
- * Matches 0 or more characters in a single path portion
- ? Matches 1 character
- [...] Matches a range of characters, similar to a RegExp range. If the first character of the range is - ! or ^ then it matches any character not in the range.
- !(pattern|pattern|pattern) Matches anything that does not match any of the patterns provided.
- ?(pattern|pattern|pattern) Matches zero or one occurrence of the patterns provided.
- +(pattern|pattern|pattern) Matches one or more occurrences of the patterns provided.
- *(a|b|c) Matches zero or more occurrences of the patterns provided
- @(pattern|pat*|pat?erN) Matches exactly one of the patterns provided
- ** If a "globstar" is alone in a path portion, then it matches zero or more directories and subdirectories searching for matches.
Recursively exclude FILES which name begins from underscore
Solution attempt
- First we need to match zero or more directories (I suppose, it means "in this directory and below"). As far as I understood the documentation,
**
should do it. - Next we need to exclude the files which name begins from underscore. AFAIK it is
[^_]*
. - The filename extension left. Maybe
.pug
will will be enough, but.+(pug)
allow to scale the solution ton
filename extensions like.+(pug|haml)
.
/Pages/Open/**/[^_]*.+(pug)
The EntryPoint.pug
was excluded, however it's name does not begin from underscore.
Recursively exclude DIRECTORIES which name begins from underscore
Solution attempt
All that I know is "globstar matches zero or more directories and subdirectories searching for matches" and "[^_]
" excludes underscore. Looks like it's not enough to build the correct solution. Below solution in intuitive and does not work.
/Pages/Open/[^_]**/*.+(pug)
Recursively exclude files AND directories which name begins from underscore
Can we reach this effect just by combining the solution for files and directories?
from Exclude files and/or folders recursively which name begins from certain symbol in NodeJS's Glob (on underscore example)
No comments:
Post a Comment