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

# Rename

Rename file on disk

## Declaration

Source position: systemh.inc line 1260

`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

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.

Documentation generated on: May 14 2021