Method mv()

Method mv

int mv(string from, string to)


Rename or move a file or directory.

If the destination already exists, it will be replaced. Replacement often only works if to is of the same type as from, i.e. a file can only be replaced by another file and so on. Also, a directory will commonly be replaced only if it's empty.

On some OSs this function can't move directories, only rename them.


Returns 0 (zero) on failure, 1 otherwise. Call errno() to get more error info on failure.

See also