createDirectory

JVM
JRE7
1.4
@ExperimentalPathApi fun Path.createDirectory(
    vararg attributes: FileAttribute<*>
): Path

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.

Parameters

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

Exceptions

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

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

UnsupportedOperationException - if the attributesarray contains an attribute that cannot be set atomically when creating the directory.

See Also

Files.createDirectory