This function will rename the specified file with the specified name. The function will return true if the file has successfully been renamed, or false in any other circumstances.
WARNING This may not work as you expect due to GameMaker being sandboxed! Please see the section on The File System for more information.
file_rename(oldname, newname);
Argument | Type | Description |
---|---|---|
oldname | String | The name of the file to change. |
newname | String | The new name to give the file. |
if (file_exists("level1.txt"))
{
file_rename("level1.txt", "level.txt");
}
This would check for a file and if it exists it is renamed.