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
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?
I read the following documentation but this is still ambiguous to me: http://ant.apache.org/manual/dirtasks.html#patterns
If there is an Ant-Pattern tester (similar to http://regexpal.com/) that would be amazing.
ISBN 0-521-64568-9 . ... common approaches to solving recurring problems that prove to be ineffective. These approaches are called antipatterns.
public class AntPathMatcher extends Object implements PathMatcher. PathMatcher implementation for Ant-style path patterns. Part of this mapping code has been kindly borrowed from Apache Ant. The mapping matches URLs using the following rules: ?
A FileSet is a group of files. These files can be found in a directory tree starting in a base directory and are matched by patterns taken from a number of PatternSets and Selectors. PatternSets can be specified as nested <patternset> elements.
Apache Ant gives you two ways to create a subset of files in a fileset, both of which can be used at the same time: Only include files and directories that match any include patterns and do not match any exclude patterns in a given PatternSet.
To match all files, in all directories (from the base directory and deeper)
**/*.nupkg
Will match
sample.nupkg
sample-2.nupkg
tmp/sample.nupkg
tmp/other.nupkg
other/new/sample.nupkg
**
will match any directory (multiple directories deep).
*.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: There is no Ant Pattern Tester.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With