Is it possible to iterate files in Groovy recursively? Currently I'm using FileUtils.iterateFiles()
from Apache commons-io
, but maybe there is some Groovy-native alternative for the same?
Absolutely, you should check the documentation for File in Groovy. It's available here and gives you a few different helper methods to iterate recursively over a file structure.
// Simplest possible example, iterating over each file in every subfolder
new File('.').eachFileRecurse { println it.name }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With