Tuesday, October 9, 2012

How do I use Nant/Ant naming patterns?

The rules are:
  • a single star (*) matches zero or more characters within a path name
  • a double star (**) matches zero or more characters across directory levels
  • a question mark (?) matches exactly one character within a path name
Another way to think about it is double star (**) matches slash (/) but single star (*) does not.
Let's say you have the files:
  1. bar.txt
  2. src/bar.c
  3. src/baz.c
  4. src/test/bartest.c
Then the patterns:
  • *.c             matches nothing (there are no .c files in the current directory)
  • src/*.c     matches 2 and 3
  • */*.c         matches 2 and 3 (because * only matches one level)
  • **/*.c       matches 2, 3, and 4 (because ** matches any number of levels)
  • bar.*         matches 1
  • **/bar.*   matches 1 and 2
  • **/bar*.* matches 1, 2, and 4
  • src/ba?.c matches 2 and 3    
http://stackoverflow.com/questions/69835/how-do-i-use-nant-ant-naming-patterns

No comments:

Post a Comment