Rename

Rename file on disk

Declaration

Source position: systemh.inc line 1350

  procedure Rename(var f: File; const s: ShortString);
  procedure Rename(var f: File; const p: PAnsiChar);
  procedure Rename(var f: File; const c: AnsiChar);
  procedure Rename(var f: File; const s: UnicodeString);
  procedure Rename(var f: File; const s: RawByteString);
  procedure Rename(var t: Text; const s: shortstring);
  procedure Rename(var t: Text; const p: PAnsiChar);
  procedure Rename(var t: Text; const c: AnsiChar);
  procedure Rename(var t: Text; const s: unicodestring);
  procedure Rename(var t: Text; const s: RawByteString);

Description

Rename changes the name of the assigned file F to S. F must be assigned, but not opened.

Errors

Depending on the state of the {$I} switch, a runtime error can be generated if there is an error. In the {$I-} state, use IOResult to check for errors.

See also

Name Description
Erase Delete a file from disk

Example

Program Example77;
{ Program to demonstrate the Rename function. }
Var F : Text;
begin
  Assign (F,paramstr(1));
  Rename (F,paramstr(2));
end.