Deletes a given file.



Argument Description
fname The name of the file to delete.

Returns: Boolean


This function will delete the specified file from the system. It should be noted that this function will only delete those files that GameMaker: Studio is able to create and parse: ini files, text files and binary files, or those files made to store game created resources like sprites or surfaces. However, it will not delete any other file. The function will also return true if the file has successfully been removed, or false in any other circumstances.

WARNING! This function may not work as you expect due to GameMaker: Studio being sandboxed! Please see the section on File System Limits for more information.


if file_exists("level.txt")

This would check for a file and if it exists it is deleted.

Back: File System Functions
Next: file_rename
© Copyright YoYo Games Ltd. 2018 All Rights Reserved