createDirectories

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

Creates a directory ensuring that all nonexistent parent directories exist by creating them first.

If the directory already exists, this function does not throw an exception, unlike Path.createDirectory.

Since Kotlin

1.5

Return

the path of this directory if it already exists or has been created successfully. The returned path can be converted to absolute path if it was relative.

Parameters

attributes

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

See also

Throws

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

if an I/O error occurs.

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