# filter

abstract fun filter(filterClosure: Closure): FileCollection(source)

Restricts the contents of this collection to those files which match the given criteria. The filtered collection is live, so that it reflects any changes to this collection.

The given closure is passed the File as a parameter, and should return a boolean value. The closure should return `true`' to include the file in the result and `false` to exclude the file from the result.

#### Return

The filtered collection.

#### Parameters

filterClosure

The closure to use to select the contents of the filtered collection.

abstract fun filter(filterSpec: Spec<in File>): FileCollection(source)

Restricts the contents of this collection to those files which match the given criteria. The filtered collection is live, so that it reflects any changes to this collection.

#### Return

The filtered collection.

#### Parameters

filterSpec

The criteria to use to select the contents of the filtered collection.