Below you can see a nice solution for finding all XML files in a directory tree:
// pass a directory or use the current directory
def folder = args?.size() ? args[0] : "."
println "reading files from directory '$folder'"
def basedir = new File(folder)
// result files of the current run
files = basedir.listFiles().grep(~/.*xml$/)
List resultLines() {
List result = []
for (currentFile in files) {
println " processing $currentFile"
}
return result
}
2 comments:
Good one.
Very useful! Thanks a ton!
Post a Comment