Core selectors

Selectors are a specific subset of Phing data types that allow you to fine-tune matching in a Core TypesFileSet (or DirSet).

Phing supports the following core selectors, which typically match on both files and directories in a <fileset>:

  • <Contains> - Select files that contain a specific string

  • <date> - Select files/directories that have been modified either before or after a specific date/time

  • <Depend> - Select files/directories that have been modified more recently than equivalent items elsewhere

  • <Depth> - Select files/directories that appear at a specific depth in a directory tree

  • <Filename> - Select files/directories whose name matches a particular pattern. Equivalent to the include and exclude elements of a patternset.

  • <Present> - Select files/directories that either do or do not exist in some other location

  • <Containsregexp><containsregexp> - Select files that contain text matching a regular expression

  • <Size><size> - Select files that are larger or smaller than a particular number of bytes.

  • <Type><type> - Select files/directories by type ('file' or 'dir')

Additionally, to create more complex selections, a variety of selectors that contain other selectors are available for your use. They combine the selections of their child selectors in various ways.

Phing supports the following selector containers:

  • <And><and> - Select a file only if all the contained selectors select it.

  • <Majority><majority> - Select a file only if all the contained selectors select it.

  • <None><none> - Select a file only if none of the contained selectors select it.

  • <Not><not> - Can contain only one selector, and reverses what it selects and doesn't select.

  • <Or><or> - Select a file if any one of the contained selectors selects it.

  • <Selector><selector> - Contains only one selector and forwards all requests to it without alteration. This is the selector to use if you want to define a reference. It is usable as an element of <project>.