I need help with saving list of files into collection.
def collection = {
new File("/path/to/directory/").listFiles().sort { it.name }.reverse().each { def f ->
println f.name
}
}
This one is only printing result I want to have in collection
result that i want: list = [file1.jpg, file2.jpg, file3.jpg]
On the internet I found only recursive methods, but those dont fit to my code.