[ Operating System | Reference Manual | Alphabetic Index ]
rename(+OldName, +NewName)
Renames the file OldName to NewName.
- OldName
- String or atom.
- NewName
- String or atom.
Description
OldName and NewName are absolute or relative pathnames of files. Used
to rename the file OldName with the name NewName.
Modes and Determinism
Exceptions
- (4) instantiation fault
- Either OldName or NewName are not instantiated.
- (5) type error
- Either OldName or NewName are neither a string nor an atom.
- (190) end of file reached
- File OldName does not exist.
Examples
Success:
[eclipse]: sh('ls file1').
file1
[eclipse]: rename(file1, file2).
yes.
[eclipse]: sh('ls file1 file2').
file1 not found
file2
yes.
Error:
rename(Old, any). (Error 4).
rename(any, New). (Error 4).
rename(1, any). (Error 5).
rename(notfile, newfile). (Error 190).
See Also
exists / 1, delete / 1, mkdir / 1