walk

JVM
JRE7
1.7
@ExperimentalPathApi fun Path.walk(
    vararg options: PathWalkOption
): Sequence<Path>

(source)

Returns a sequence of paths for visiting this directory and all its content.

By default, only files are visited, in depth-first order, and symbolic links are not followed. The combination of options overrides the default behavior. See PathWalkOption.

The order in which sibling files are visited is unspecified.

If after calling this function new files get added or deleted from the file tree rooted at this directory, the changes may or may not appear in the returned sequence.

If the file located by this path does not exist, an empty sequence is returned. if the file located by this path is not a directory, a sequence containing only this path is returned.