Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Rename Procedure
◄Summary► ◄Details► ◄Example► ◄Back►
Arguments
file_variable Typed, untyped, or text file; already assigned
filename String expression representing the new file name
Description
The Rename procedure changes the name of an existing file of any
type. The filename argument supplies a new name for an external
file. A prior call to the Assign procedure must associate
file_variable with an existing external file. The file must
not be open. Rename works the same as the DOS command RENAME or
its synonym REN.
If no file exists with the name assigned to file_variable, or if a
file already exists with the name supplied in filename, an I/O
error occurs.
To prevent a program from halting with a run-time error when an I/O
error occurs, turn off I/O checking with {$I-} and check the return
value of the IOResult function.