rename

Syntax

int rename(const char *old, const char *new)

Arguments

old
The current name of the filesystem entry.
new
The new name of the filesystem entry.

Return

0 if successful, otherwise -1.

Description

Renames a file or directory from the filesystem by specifying the name and/or path to that entry through the old and new arguments.
If successful, 0 is returned, otherwise -1 is returned and an error is set.
You can use this function to rename files and directories or to move files and subdirectories into other directories.

Comments

Everyone can add his comments about his experiences with this function here. Tips for using it are welcome, too.