Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD

## org.gradle.api.file
[Java] Interface FileTree

    org.gradle.api.file.FileTree
      org.gradle.api.file.FileCollection
          org.gradle.api.tasks.AntBuilderAware
              org.gradle.api.Buildable

All Superinterfaces:
  AntBuilderAware, FileCollection, Buildable

    public interface FileTree
    extends FileCollection

A `FileTree` represents a hierarchy of files. It extends FileCollection to add hierarchy query and manipulation methods. You typically use a `FileTree` to represent files to copy or the contents of an archive.

You can obtain a `FileTree` instance using Project.fileTree, Project.zipTree or Project.tarTree.

Method Summary
`FileTree` | `getAsFileTree()` Returns this.
`FileTree` | `matching(groovy.lang.Closure filterConfigClosure)`
`FileTree` | `matching(PatternFilterable patterns)`
`FileTree` | `plus(FileTree fileTree)` Returns a `FileTree` which contains the union of this tree and the given tree.
`FileTree` | `visit(FileVisitor visitor)` Visits the files and directories in this file tree.
`FileTree` | `visit(groovy.lang.Closure visitor)` Visits the files and directories in this file tree.

Methods inherited from interface FileCollection
add, addToAntBuilder, addToAntBuilder, asType, contains, filter, filter, getAsFileTree, getAsPath, getFiles, getSingleFile, isEmpty, minus, plus, stopExecutionIfEmpty

Methods inherited from interface java.lang.Iterable
java.lang.Iterable#iterator()

Methods inherited from interface AntBuilderAware
addToAntBuilder

Methods inherited from interface Buildable
getBuildDependencies

Method Detail

### getAsFileTree

    public FileTree getAsFileTree()

  Returns this.
  Returns:
    this

### matching

    public FileTree matching(groovy.lang.Closure filterConfigClosure)

  Restricts the contents of this tree to those files matching the given filter. The filtered tree is live, so that any changes to this tree are reflected in the filtered tree.

  The given closure is used to configure the filter. A PatternFilterable is passed to the closure as it's delegate. Only files which match the specified include patterns will be included in the filtered tree. Any files which match the specified exclude patterns will be excluded from the filtered tree.

  Parameters:
    `filterConfigClosure` - the closure to use to configure the filter.
  Returns:
    The filtered tree.

### matching

    public FileTree matching(PatternFilterable patterns)

  Restricts the contents of this tree to those files matching the given filter. The filtered tree is live, so that any changes to this tree are reflected in the filtered tree.

  The given pattern set is used to configure the filter. Only files which match the specified include patterns will be included in the filtered tree. Any files which match the specified exclude patterns will be excluded from the filtered tree.

  Parameters:
    `patterns` - the pattern set to use to configure the filter.
  Returns:
    The filtered tree.

### plus

    public FileTree plus(FileTree fileTree)

  Returns a `FileTree` which contains the union of this tree and the given tree. The returned tree is live, so that changes to either this tree or the other source tree are reflected in the returned tree.
  Parameters:
    `fileTree` - The tree. Should not be null.
  Returns:
    The union of this tree and the given tree.

### visit

    public FileTree visit(FileVisitor visitor)

  Visits the files and directories in this file tree. Files are visited in breadth-wise order, so that a directory is visited before its children.
  Parameters:
    `visitor` - The visitor.
  Returns:
    this

### visit

    public FileTree visit(groovy.lang.Closure visitor)

  Visits the files and directories in this file tree. Files are visited in breadth-wise order, so that a directory is visited before its children. The file/directory to be visited is passed to the given closure as a FileVisitDetails
  Parameters:
    `visitor` - The visitor.
  Returns:
    this

Groovy Documentation