api / org.gradle.api.file / FileCollection / filter

filter

abstract fun filter(filterClosure: Closure<Any>): FileCollection

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.

Parameters

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

Return
The filtered collection.

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

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.

Parameters

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

Return
The filtered collection.