From Appmethod Libraries
Jump to: navigation, search

Object Pascal

function RenameFile(const OldName, NewName: string): Boolean;


extern DELPHI_PACKAGE bool __fastcall RenameFile(const System::UnicodeString OldName, const System::UnicodeString NewName);


Type Visibility Source Unit Parent
function public
System.SysUtils System.SysUtils


Changes a file name.

RenameFile attempts to change the name of the file specified by OldFile to NewFile. If the operation succeeds, RenameFile returns True. If RenameFile cannot rename the file (for example, if the application does not have permission to modify the file), it returns False.

Note: If the OldName parameter is a symbolic link, the method is performed on the target file.

Note: If NewFile represents the name of an existing file, RenameFile behaves differently under Windows and Macintosh. Under Windows, the renaming operation fails.

See Also

Code Examples