## MultiRootFileSet

Since Ant 1.9.4

A MultiRootFileSet is a group of files or directories. These files or directories can be found in a directory forrest starting with a set of base directories and are matched by patterns taken from a number of PatternSets and Selectors.

MultiRootFileSet acts as a union of FileSets and DirSets that share the same patterns and selectors.

MultiRootFileSet supports all attributes and nested elements of FileSet and DirSet except for the dir attribute.

Attribute | Description | Required
--- | --- | ---
basedirs | Comma separated list of directories that build the roots of the MultiRootFileSet. | No
cache | Whether to cache results; disabling may seriously impact performance | No; default is true

type

The type of file system entities which will be included in this set. Acceptable values are:

- file—regular files
- dir—directories
- both—regular files and directories

No; defaults to file

includes | A 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. | No
excludes | A 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 and Windows junctions be followed? See fileset's documentation. Windows junctions are detected since Ant 1.10.16. | No; defaults to true
erroronmissingdir | Specify what happens if one of the base directories does not exist. If true a build error will happen, if false, the subtree will be ignored/empty. | No; defaults to true

### Parameters specified as nested elements

PatternSets can be specified as nested `<patternset>` elements. In addition, MultiRootFileSet 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 MultiRootFileSet. If any of the selectors within the MultiRootFileSet do not select the file or directory, it is not considered part of the MultiRootFileSet. This makes a MultiRootFileSet equivalent to an `<and>` selector container.

In addition basedirs for the MultiRootFileSet can be specified as nested `basedir` elements that have a single file attribute.

### Examples

    <multirootfileset basedirs="${build.dir},${other.project.dir}">
      <include name="apps/**/classes"/>
      <exclude name="apps/**/*Test*"/>
    </multirootfileset>

Groups all files inside `classes` found under the `apps` subdirectory of `${build.dir}` or `${other.project.dir}`, except those that have the text `Test` in their name.

    <multirootfileset>
      <basedir file="${build.dir}"/>
      <basedir file="${other.project.dir}"
      <include name="apps/**/classes"/>
      <exclude name="apps/**/*Test*"/>
    </multirootfileset>

Is equivalent to the first example but used nested `basedir` elements. The nested elements and the basedirs attribute can be used at the same time and the will be merged.