file_rename

Renames a given file.

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 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.


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