D.5 DirSet

A DirSet is a group of directories. These directories 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. In addition, DirSet holds an implicit PatternSet and supports the nested <include>, <includesfile>, <exclude> and <excludesfile> elements of <patternset> directly, as well as <patternset>'s attributes.

Selectors are available as nested elements within the DirSet. If any of the selectors within the DirSet do not select the directory, it is not considered part of the DirSet. This makes a DirSet equivalent to an <and> selector container.

Table D.4:  Attributes for the <dirset> tag

NameTypeDescriptionDefaultRequired
dirStringThe root of the directory tree of this DirSet.n/aYes
casesensitiveBooleanSpecifies whether case-sensitivity should be applied (true|yes|on or false|no|off).trueNo
expandsymboliclinksBooleanWhether to expand/dereference (follow) symbolic links - set to 'true' to emulate old Phing behavior.falseNo
includesStringA comma- or space-separated list of patterns of directories that must be included; all directories are included when omitted.n/aNo
includesfileStringThe name of a file; each line of this file is taken to be an include pattern. Note: if the file is empty and there are no other patterns defined for the fileset, all directories will be included.n/aNo
excludesStringA comma- or space-separated list of patterns of directories that must be excluded; no directories are excluded when omitted.n/aNo
excludesfileStringThe name of a file; each line of this file is taken to be an exclude pattern.n/aNo

D.5.1 Using wildcards

  • test*.xml will include test_42.xml, but it will not include test/some.xml.

  • test**.xml fits to test_42.xml as well as to test/bla.xml, for example.

  • **/*.ent.xml fits to all files that end with ent.xml in all subdirectories of the directory specified with the dir attribute of the <fileset> tag. However, it will not include any files that are directly in the base directory of the file set.

D.5.2 Usage Examples

<dirset dir="/etc" >
  <include name="httpd/**" />
  <include name="php.ini" />
</dirset>

<dirset dir="/etc" >
  <patternset>
    <include name="**/*.php"/>
    <exclude name="**/*Test*"/>
  </patternset>
</dirset>

This will include the apache configuration and PHP configuration file from /etc.

D.5.3 Nested tags

The tags that are supported by Fileset are:

The <include> and the <exclude> tags must have a name attribute that contains the pattern to include/exclude.