createDirectories

Platform and version requirements: JVM (1.5), JRE7 (1.5)
fun Path.createDirectories(
    vararg attributes: FileAttribute<*>
): Path

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.

Parameters

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

Exceptions

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

IOException - if an I/O error occurs.

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

See Also

Files.createDirectories

© 2010–2021 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.io.path/java.nio.file.-path/create-directories.html