I am using this code to count number of files ends with 's' in a directory.
def count=0
def p = ~/.*s/
new File("c:\\shared").eachFileMatch(p) { file->
println file.getName().split("\\.")[0]
count++
}
print "$count"
If there way to avoid the temp variable and use some method in File class itself?
Thanks