Groovy: listing the content of a directory, traversing a directory tree

Listing all the files and subdirectories in a given path.

Traversing a directory tree sytarting from a specific path.

dh = new File('.')
dh.eachFile {
    println(it)
}
dh = new File('.')
dh.eachFileRecurse {
    println it
}

timestamp: 2018-06-03T15:30:01 tags:

  • File
  • eachFile
  • eachFileRecurse