mvdir Command

Purpose

Moves (renames) a directory.

Syntax

mvdir Directory1 Directory2

Description

The mvdir command renames directories within a file system. To use the mvdir command, you must have write permission to Directory1 and Directory2 as well as in the parent directories.

The Directory1 parameter must name an existing directory. If Directory2 does not exist, Directory1 is moved to Directory2. If Directory2 exists, Directory1 becomes a subdirectory of Directory2. Neither directory can be a subset of the other.

The mvdir Command can also be used to move or rename files. If the Directory1 parameter is an existing file name and the Directory2 parameter is an existing directory name, the file specified by Directory1 is moved to the directory specified by Directory2. If the Directory1 parameter is an existing file name and the Directory2 parameter does not yet exist, Directory2 replaces the file name Directory1. If both are existing file names, the file specified by Directory1 is renamed Directory2, and the existing Directory2 is removed.

The mv command provides the same functionality as the mvdir command.

The mvdir command will not rename a directory if the directory is exported for use by NFS version 4, or if the directory leads to a directory exported for use by NFS version 4. NFS version 4-exported directories and directories leading to NFS version 4-exported directories are marked as busy and remain so until unexported.

Example

To rename or move a directory to another location, enter:

mvdir appendixes manual

If manual does not exist, this renames the appendixes directory to manual.

If a directory named manual already exists, this moves appendixes and its contents to manual/appendixes. In other words, appendixes becomes a subdirectory of manual.

Files

Item Description
/usr/sbin/mvdir Contains the mvdir command.