FileRename

<< Click to Display Table of Contents >>

Navigation:  Handling Events via Scripting > Objects and Functions > File management functions >

FileRename

function FileRename(OldName, NewName: string): boolean;

 

This function actually renames a file that exists on disk. The file specified by OldName must exist. No file with the NewName name must exist.

 

Parameters

OldName

The original file name, including its path. This file must exist, Ex: 'C:\Documents\MyDoc.txt'

NewName

The destination file name, including its path. This file must not exist, otherwise the function will fail. Ex: 'C:\Documents\MyRenamedDoc.txt'

 

Return value

True

The file was successfully renamed

False

The function failed and did not rename the file (most probably destination file already existed)