← Docs
kotlin-stdlib / kotlin.io.path / java.nio.file.Path / deleteExisting

deleteExisting

JVM
JRE7
1.5
fun Path . deleteExisting ( )
(source)

Deletes the existing file or empty directory specified by this path.

Exceptions

NoSuchFileException - if the file or directory does not exist.

DirectoryNotEmptyException - if the directory exists but is not empty.

See Also

Files.delete

Stay in touch:
  • Contributing to Kotlin
  • Releases
  • Press Kit
  • Security
  • Blog
  • Issue Tracker
  • Brand assets
  • Careers
Supported and developed by JetBrains .
Kotlin™ is protected under the Kotlin Foundation
and licensed under the Apache 2 license .