I want to make a list of all the files present in a directory, using groovy.
What would a good code to do the task?
Thanks in Advance.
I want to make a list of all the files present in a directory, using groovy.
What would a good code to do the task?
Thanks in Advance.
Here is how you do that:
File[] files = new File("/some/path/you/are/interested/in").listFiles()
println( files )
That will include directories AND files. If you just want files then you can do this:
File[] files = new File("/some/path/you/are/interested/in").listFiles({ it.isFile() } as FileFilter)
println( files )