System.SysUtils.RenameFile
Delphi
function RenameFile(const OldName, NewName: string): Boolean;
C++
extern DELPHI_PACKAGE bool __fastcall RenameFile(const System::UnicodeString OldName, const System::UnicodeString NewName);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.SysUtils.pas System.SysUtils.hpp |
System.SysUtils | System.SysUtils |
Description
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.