RenameFile


 

RenameFile>file,newfile

 

Renames file to newfile.

 

By default if newfile already exists it will not be overwritten and the new file will be renamed appropriately.  It is possible to change the behaviour to overwrite instead by setting CF_OVERWRITE to 1.  The default value of CF_OVERWRITE is 0.

 

This function does the same as MoveFile with MF_RENAME set to 1.

 

The outcome of the operation will be reported in variables CF_RESULT and CF_RESULT_CODE.  If the operation was aborted or could not proceed CF_RESULT will be False.  CF_RESULT_CODE will contain a numeric code returned by the operating system where 0 indicates success.  For details of the codes that may be returned see the SHFileOperation function documentation at msdn.microsoft.com.

 

To enable operating system file operation animations set CF_ANIMATE to 1.

 

Abbreviation : Ren

See also: CopyFile, DeleteFile, IfFileExists, AppendFile, MoveFile

 

Example

 

RenameFile>c:\temp\myfile.txt,c:\temp\myfile.bak