file_rename

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 function may not work as you expect due to GameMaker being sandboxed! Please see the section on The File System for more information.

 

Syntax:

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.

 

Returns:

Boolean

 

Example:

if file_exists("level1.txt")
{
    file_rename("level1.txt", "level.txt");
}

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