Orangevolt ANT Tasks » Tasks
ExampleExample

2.6.  find

The find task finds a single file matching a given pattern. This task gives you the ability to get the filename, path etc. into separate ant properties.

This task is useful if you use files containing version and build informations which may vary over the time. Using find you can match the requested file by its constant name parts.

If more than one file will be found the first one will be taken. Additional a warn message will be written.

If no matching file was found no property will be defined.

Attributes

Name Description Required
dir The base directory for the search. yes
file

The file pattern to match. Every file matching the pattern will be accepted. The pattern format for the file attribute is identical to the one of Ant FileSet includes pattern format.

The file property can also be set by using the inner element <file> (which is Ant FileSet conform).

yes if no inner element <file> is defined.
nameNoExtensionProperty This property will contain the name of the found file witout path and extension. yes if no other *Property attribute is defined.
nameProperty This property will contain the name of the found file without path. yes if no other *Property attribute is defined.
pathProperty This property will contain the path of the found file (without name). yes if no other *Property attribute is defined.
property This property will contain the path and name of the found file. yes if no other *Property attribute is defined.

The find task supports currently only finding files. If finding classpath resources/classes is on your wishlist - drop me a line.