Xojo.IO.FolderItem.Delete

From Xojo Documentation

Method

Xojo.IO.FolderItem.Delete()

Supported for all project types and targets.

Deletes the file or folder specified by the FolderItem.

Notes

This method irreversibly removes the file or directory from the volumes it is stored on. It does not put things in the "trash". Folders must be empty before they can be deleted.

Exceptions

  • RuntimeException if the FolderItem cannot be deleted. This could occur because:
    • The file is in use
    • The file is locked
    • The folder is not empty
    • The volume, file or folder is not longer available

Sample Code

Delete a file:

Using Xojo.IO
Var f As FolderItem = SpecialFolder.Documents.Child("MyFile.txt")

If f.Exists Then
f.Delete
End If