walk

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. If encountered, symbolic links are included in the sequence as-is, and the content of the directory they point to is not visited. 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.

When iterating the returned sequence, the following exceptions could be thrown:

Since Kotlin

1.7