Resolve source path

I want to resolve a source path, something like getSource() from DefaultCopySpec. Can I do that without using some implementation of CopySpec? Thanks.

Can you elaborate on your use case? You can potentially use eachFile() to get at this info but that requires actually performing the copy operation.

It’s hard to know exactly what you want without an example but I think you can use a fileTree and matching. Eg:

def tree = fileTree("someFolder").matching {
   include "**/*.txt"
} 
Set<File> files = tree.files

See also [FileTree] (https://docs.gradle.org/current/javadoc/org/gradle/api/file/FileTree.html) and FileCollection javadocs