createDirectories

abstract fun createDirectories(path: Path, mustCreate: Boolean = false)(source)

Creates a directory tree represented by the path. If path already exists then the method throws kotlinx.io.IOException when mustCreate is true. The call will attempt to create only missing directories. The method is not atomic and if it fails after creating some directories, these directories will not be deleted automatically. Permissions for created directories are platform-specific.

Parameters

path

the path to be created.

mustCreate

the flag indicating that existence of path should be treated as an error, by default it is false.

Throws

when path is an existing file and mustCreate is false.