Lua:deleteFile
Jump to navigation
Jump to search
<> Reference
function deleteFile(pathtofile) : boolean
Deletes the file at the specified path.
Returns true if a file existed at that path and does not exist anymore after the call.
Function Parameters
| Parameter | Type | Description |
|---|---|---|
| pathtofile | String | The path to the file to delete. |
Returns
boolean — True if a file existed at the specified path and no longer exists after the call, otherwise false.
Examples
1 local path = "C:\\\\Temp\\\\example.txt"
2
3 if deleteFile(path) then
4 print("File deleted")
5 else
6 print("File was not deleted")
7 end
See Also
Main Pages