List files recursively in Kotlin
To list files recursively in Kotlin use one of.walk(...)
, .walkBottomUp()
or .walkTopDown()
extensions for File
, which differ only in the order in which the files appear and all produce a FileTreeWalk
, that implements Sequence
:File("/tmp").walkTopDown().forEach { println(it) }