Name

mv

Synopsis

mv [option] sources target
                  

Moves or renames files and directories. The source (first column) and target (second column) determine the result (third column):

Source

Target

Result

File

name (nonexistent)

Rename file to name.

File

Existing file

Overwrite existing file with source file.

Directory

name (nonexistent)

Rename directory to name.

Directory

Existing directory

Move directory to be a subdirectory of existing directory.

One or more files

Existing directory

Move files to directory.

mv does not preserve resource forks or HFS metadata when moving files that contain them. For such files, use MvMac instead.

Options

-f

Force the move, even if target file exists; suppress messages about restricted access modes.

-i

Query user before removing files.

Get Mac OS X in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.