rename

Updates a file name from oldname to newname. Returns 0 if successful and non-zero otherwise. An optional output argument, errormessage, can be used to retrieve any additional system error messages on failure.

Syntax

R = rename(oldname, newname)

[R, errormessage] = rename(oldname, newname)

Inputs

oldname
Type: string
newname
Type: string

Outputs

R
A value of 0 indicates that the file rename operation was successful.
Type: integer
errormessage (optional)
String which will return the system error message in case of failures.
Type: string

Examples

R = rename('abs1.oml', 'foo.oml')

R = 0
Retrieve system error message on failure:
[R, errormessage] = rename('abs1.oml', 'foo.oml')
R = -1
errormessage = No such file or directory