help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



[Overview][Constants][Types][Classes][Procedures and functions][Variables] Reference for unit 'sysutils' (#rtl)

RenameFile

Rename a file.

Declaration

Source position: filutilh.inc line 95

function RenameFile(

  const OldName: String;

  const NewName: String

):Boolean;

Description

RenameFile renames a file from OldName to NewName . The function returns True if successful, False otherwise. Remark: you cannot rename across disks or partitions.

Errors

On Error, False is returned.

See also

DeleteFile

  

Delete a file from the filesystem.

Example

Program Example44;

{ This program demonstrates the RenameFile function }

Uses sysutils;

Var F : Longint;
    S : String;

Begin
  S:='Some short file.';
  F:=FileCreate ('test.dap');
  FileWrite(F,S[1],Length(S));
  FileClose(F);
  If RenameFile ('test.dap','test.dat') then
    Writeln ('Successfully renamed files.');
End.

Notes

 No notes exist for this page yet. 





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505