delete2
Deletes the file or directory denoted by this abstract pathname.
If this pathname denotes a directory, then the directory must be empty in order to be deleted.
Return
The File for chaining operations.
Parameters
If the underlying filesystem is a Windows filesystem, then attempting to delete a file marked as read-only
will result in an AccessDeniedException. If true
, the read-only
attribute will be ignored and the file deleted. If false
, then the AccessDeniedException will be thrown. This parameter is ignored on non-Windows filesystems. Default false
.
If false
, failure to delete the file or directory due to its non-existence on the filesystem will return safely, instead of throwing FileNotFoundException. If true
, then the FileNotFoundException will be thrown. Default false
.
Throws
If there was a failure to delete the File, such as a directory not being empty or the filesystem threw a security exception.
On Kotlin/JS-Browser.