onPostVisitDirectory

abstract fun onPostVisitDirectory(function: (directory: Path, exception: IOException?) -> FileVisitResult)(source)

Overrides the corresponding function of the built FileVisitor with the provided function.

The provided callback is invoked for a directory after its contents have been visited, or when the iteration of the directory's immediate children is completed prematurely due to an I/O exception or onVisitFile returning FileVisitResult.SKIP_SIBLINGS. Depending on the return value of the function:

Note that the callback is not invoked for directories whose contents were not visited.

By default, if the directory iteration completes without an I/O exception, FileVisitor.postVisitDirectory of the built file visitor returns FileVisitResult.CONTINUE; otherwise, it re-throws the I/O exception that caused the iteration to complete prematurely.

Since Kotlin

2.1

See also