## 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.

Attribute | Description | Required
--- | --- | ---
dir | The root of the directory tree of this DirSet. | Yes
includes | Comma- or space-separated list of patterns of directories that must be included. | No; defaults to all directories
includesfile | 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. | No
excludes | Comma- or space-separated list of patterns of directories that must be excluded. | No; defaults to none
excludesfile | Name of a file; each line of this file is taken to be an exclude pattern. | No
casesensitive | Specifies whether case-sensitivity should be applied (true, yes, on or false, no, off). | No; defaults to true
followsymlinks | Shall symbolic links be followed? See fileset's documentation. | No; defaults to true
erroronmissingdir | Specify what happens if the base directory does not exist. If true a build error will happen, if false, the dirset will be ignored/empty. Since Apache Ant 1.7.1 | No; defaults to true (for backward compatibility reasons)
refid | Makes this `dirset` a reference to a `dirset` defined elsewhere. If specified no other attributes or nested elements are allowed. | No

#### Examples

    <dirset dir="${build.dir}">
      <include name="apps/**/classes"/>
      <exclude name="apps/**/*Test*"/>
    </dirset>

Groups all directories named `classes` found under the `apps` subdirectory of `${build.dir}`, except those that have the text `Test` in their name.

    <dirset dir="${build.dir}">
      <patternset id="non.test.classes">
        <include name="apps/**/classes"/>
        <exclude name="apps/**/*Test*"/>
      </patternset>
    </dirset>

Groups the same directories as the above example, but also establishes a PatternSet that can be referenced in other `<dirset>` elements, rooted at a different directory.

    <dirset dir="${debug_build.dir}">
      <patternset refid="non.test.classes"/>
    </dirset>

Groups all directories in directory `${debug_build.dir}`, using the same patterns as the above example.

    <dirset id="dirset" dir="${workingdir}">
       <present targetdir="${workingdir}">
            <mapper type="glob" from="*" to="*/${markerfile}"/>
       </present>
    </dirset>

Selects all directories somewhere under `${workingdir}` which contain a `${markerfile}`.