Closed andrenth closed 2 years ago
I don't plan to implement a walk behavior for this, but in version 0.5.0
this can be accomplished using negations.
For applications like shells that wish to filter in this way regardless of the given glob expression, the filter_tree
and not
functions can be used. For nominally hidden files on Unix, something like this should work while accepting arbitrary glob expressions:
let glob = Glob::new(expression).unwrap();
for entry in glob.walk(path).not(["**/.*/**"]).unwrap() {
let entry = entry.unwrap();
println!("> {:?}", entry);
}
This pattern can also be encoded explicitly in a glob expression. For example, the expression [!.]*
matches a component that does not begin with .
. This can be used in a tree expression like <[!.]*/>[!.]*
, which matches any number of such components (like **
but rejecting paths where any component begins with .
).
Thanks, the solution using not
does it for me.
Hello
Wax currently matches "hidden" files with a wildcard glob, which differs from traditional Unix shell globs:
Is this by design? Do you think a behavior field could be added to make it work like shell globs?