file_rename

Syntax:

file_rename(oldname, newname);


Argument Description
oldname The name of the file to change.
newname The new name to give the file.


Returns: Boolean


Description

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 Studio 2 being sandboxed! Please see the section on File System Limits for more information.


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.