list

open suspend override fun list(directory: Path): List<Path>(source)

Retrieves a sorted list of paths within the specified directory. The listing is not recursive.

The operation is performed with Dispatchers.IO context.

Return

A list of paths within the specified directory, sorted by name. Returns an empty list if an error occurs or the directory is empty.

Parameters

directory

The directory path whose contents are to be listed.

Throws

if directory is not a directory or doesn't exist.

if an I/O error occurs during listing.