I am trying to recursively list all files that match a particular file type in Groovy. This example almost does it. However, it does not list the files in the root folder. I
// Define closure def result findTxtFileClos = { it.eachDir(findTxtFileClos); it.eachFileMatch(~/.*.txt/) {file -> result += "${file.absolutePath}\n" } } // Apply closure findTxtFileClos(new File(".")) println result