DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

rename(1)


rename -- change the name of a file

Synopsis

rename old new

Description

rename renames a file. old is the pathname of the file or directory to be renamed. new is the new pathname of the file or directory. Both old and new must be of the same type (either both files, or both directories) and must reside on the same file system.

If new already exists, it is removed. Thus, if new names an existing directory, the directory must not have any entries other than, possibly, . and ... When renaming directories, the new pathname must not name a descendant of old. The implementation of rename ensures that upon successful completion a link named new will always exist.

If the final component of old is a symbolic link, the symbolic link is renamed, not the file or directory to which it points.

Write permission is required for both the directory containing old and the directory containing new.

References

link(2), rename(2), unlink(2)

Notices

The system can deadlock if there is a loop in the file system graph. Such a loop takes the form of an entry in directory a, say a/foo, being a hard link to directory b, and an entry in directory b, say b/bar, being a hard link to directory a. When such a loop exists and two separate processes attempt to perform rename a/foo b/bar and rename b/bar a/foo, respectively, the system may deadlock attempting to lock both directories for modification. The system administrator should replace hard links to directories by symbolic links.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004