createDirectory

inline fun Path.createDirectory(vararg attributes: FileAttribute<*>): Path(source)

Creates a new directory or throws an exception if there is already a file or directory located by this path.

Note that the parent directory where this directory is going to be created must already exist. If you need to create all non-existent parent directories, use Path.createDirectories.

Since Kotlin

1.5

Parameters

attributes

an optional list of file attributes to set atomically when creating the directory.

See also

Throws

if there is already a file or directory located by this path (optional specific exception, some implementations may throw more general IOException).

if an I/O error occurs or the parent directory does not exist.

if the attributes array contains an attribute that cannot be set atomically when creating the directory.