gradle
8.4

# fileTree

abstract fun fileTree(baseDir: Any): ConfigurableFileTree(source)

Creates a new `ConfigurableFileTree` using the given base directory. The given baseDir path is evaluated as per file.

The returned file tree is lazy, so that it scans for files only when the contents of the file tree are queried. The file tree is also live, so that it scans for files each time the contents of the file tree are queried.

#### Return

the file tree. Never returns null.

#### Parameters

baseDir

The base directory of the file tree. Evaluated as per file.

abstract fun fileTree(args: Map<String, out Any>): ConfigurableFileTree(source)

Creates a new `ConfigurableFileTree` using the provided map of arguments. The map will be applied as properties on the new file tree. Example:

    fileTree(dir:'src', excludes:['**/ignore/**','**/.svn/**'])

Content copied to clipboard

The returned file tree is lazy, so that it scans for files only when the contents of the file tree are queried. The file tree is also live, so that it scans for files each time the contents of the file tree are queried.

#### Return

the configured file tree. Never returns null.

#### Parameters

args

map of property assignments to `ConfigurableFileTree` object

abstract fun fileTree(baseDir: Any, configureClosure: Closure): ConfigurableFileTree(source)

Creates a new `ConfigurableFileTree` using the given base directory. The given baseDir path is evaluated as per file. The closure will be used to configure the new file tree. The file tree is passed to the closure as its delegate. Example:

    fileTree('src') {
       exclude '**/.svn/**'
    }.copy { into 'dest'}

Content copied to clipboard

The returned file tree is lazy, so that it scans for files only when the contents of the file tree are queried. The file tree is also live, so that it scans for files each time the contents of the file tree are queried.

#### Return

the configured file tree. Never returns null.

#### Parameters

baseDir

The base directory of the file tree. Evaluated as per file.

configureClosure

Closure to configure the `ConfigurableFileTree` object.