Icon FileRename

Unit: Internal

Available In: Server Applications

procedure FileRename(const FileName: String;
                     const NewFileName: String)

The FileRename procedure renames the file specified in the input parameter to the specified new file name. If the file cannot be renamed for any reason, an exception will be raised.

Information The specified file names should contain absolute paths. Relative paths are permitted, but they rely on the current working directory. The current working directory is a per-process setting and is not reliable in a multi-threaded setting like the web server.

Examples

if FileExists('C:\temp\test.html') and (not FileExists('C:\temp\newtest.html')) then
   FileRename('C:\temp\test.html','C:\temp\newtest.html');
Image