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.
attributes - an optional list of file attributes to set atomically when creating the directory.
FileAlreadyExistsException - 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).
IOException - if an I/O error occurs.
UnsupportedOperationException - if the attributes array contains an attribute that cannot be set atomically when creating the directory.
Return the path of this directory if it already exists or has been created successfully. The returned path can be converted Path.toAbsolutePath if it was relative.
See Also
© 2010–2023 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