Skip to main content

rename

Function rename 

Source
pub fn rename(oldname: string, newname: string) -> option<boolean>
Expand description

Renames a file or directory.

§Parameters

  • oldname: the current name.
  • newname: the new name.

§Return value

True on success; in case of errors, nil plus an error message and an error code.

§Examples

assert(os.rename("draft.txt", "final.txt"))

§See also

remove