Ant 模式匹配 - * 与 **
我们正在使用 TeamCity 生成我们不想清理的 *.nupkg
工件.TeamCity 提供了一个字段,您可以在其中指定一个 ANT 样式的模式来指示您希望或不想清除哪些文件.让我们假设我们有以下不想被清理的文件:
We are using TeamCity to produce *.nupkg
artifacts which we don't want to be cleaned up. TeamCity provides a field where you can specify an ANT-style pattern for indicating which files you do or don't want to be cleaned up. Let's assume for a second that we have the following files which we do not want to be cleaned up:
/a.nupkg
/dir1/b.nupkg
/dir1/dir2/c.nupkg
*.nupkg
模式是否匹配根目录和所有子目录中的 .nupkg
文件,或者确实需要使用 **.*nupkg
遍历所有目录?
Does the *.nupkg
pattern match .nupkg
files both in the root directory AND all child directories or do need to use **.*nupkg
to traverse all directories?
我阅读了以下文档,但这对我来说仍然不明确:http://ant.apache.org/manual/dirtasks.html#patterns
I read the following documentation but this is still ambiguous to me: http://ant.apache.org/manual/dirtasks.html#patterns
如果有一个 Ant-Pattern 测试器(类似于 http://regexpal.com/)太棒了.
If there is an Ant-Pattern tester (similar to http://regexpal.com/) that would be amazing.
匹配所有目录中的所有文件(从基目录和更深的目录)
To match all files, in all directories (from the base directory and deeper)
**/*.nupkg
会匹配
sample.nupkg
sample-2.nupkg
tmp/sample.nupkg
tmp/other.nupkg
other/new/sample.nupkg
**
将匹配任何目录(多个目录深度).
**
will match any directory (multiple directories deep).
*.nupkg
将匹配任何带有 nupkg 扩展名的文件.或者只是 *
将匹配任何文件或任何目录(但只有一个目录深度).
*.nupkg
will match any file with the nupkg extension. Or just *
will match any file or any directory (but just a single directory deep).
PS:没有 Ant Pattern Tester.
PS: There is no Ant Pattern Tester.