Files.Delete(IPath) Method

Definition

Deletes a file.

[Android.Runtime.Register("delete", "(Ljava/nio/file/Path;)V", "", ApiSince=26)]
public static void Delete (Java.Nio.FileNio.IPath? path);
[<Android.Runtime.Register("delete", "(Ljava/nio/file/Path;)V", "", ApiSince=26)>]
static member Delete : Java.Nio.FileNio.IPath -> unit

Parameters

path
IPath

the path to the file to delete

Attributes

Remarks

Deletes a file.

An implementation may require to examine the file to determine if the file is a directory. Consequently this method may not be atomic with respect to other file system operations. If the file is a symbolic link then the symbolic link itself, not the final target of the link, is deleted.

If the file is a directory then the directory must be empty. In some implementations a directory has entries for special files or links that are created when the directory is created. In such implementations a directory is considered empty when only the special entries exist. This method can be used with the #walkFileTree walkFileTree method to delete a directory and all entries in the directory, or an entire file-tree where required.

On some operating systems it may not be possible to remove a file when it is open and in use by this Java virtual machine or other programs.

Java documentation for java.nio.file.Files.delete(java.nio.file.Path).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to