什么是glob模式匹配不以下划线开头的所有文件忽略那些以下划线开头的目录?

鉴于目录结构:

a/ b/ _private/ notes.txt c/ _3.txt 1.txt 2.txt d/ 4.txt 5.txt 

我怎么能写一个glob模式(与npm模块glob兼容),select以下path?

 a/b/c/1.txt a/b/c/2.txt a/b/d/4.txt a/b/5.txt 

这是我所尝试的:

 // Find matching file paths inside "a/b/"... glob("a/b/[!_]**/[!_]*", (err, paths) => { console.log(paths); }); 

但是这只会发出:

 a/b/c/1.txt a/b/c/2.txt a/b/d/4.txt 

随着一些试验和错误(和grunt(minimatch / glob)文件夹排除的帮助 ),我发现以下似乎达到我正在寻找的结果:

 // Find matching file paths inside "a/b/"... glob("a/b/**/*", { ignore: [ "**/_*", // Exclude files starting with '_'. "**/_*/**" // Exclude entire directories starting with '_'. ] }, (err, paths) => { console.log(paths); });