mv
Move files and folders.
SYNTAX
mv [options] source_file target_file
mv [options] source_folder target_folder
OPTIONS
-n Do not overwrite any existing file.
-i Prompt before moving a file that would overwrite an existing file.
A response `y' or `Y', will allow the move to proceed
(writes to standard error)
-f Always Overwrite destination files
(Do not prompt for confirmation)
-v Verbose, show filenames.
The -n and -v options are non-standard and their use in scripts is not recommended.
EXAMPLES
Move all files with names ending in ".jpg" from the current folder
to the Documents directory
mv *.jpg ~/Documents
Move the "Documents" folder to "Documents backup".
mv Documents "Documents backup"
quotes are needed because of the space in the folder name.
Renaming a bunch of file extensions
e.g. change *.txt into *.htm
for f in *.txt; do mv ./"$f" "${f%txt}htm"; done
Related commands:
cp - Copy files
CpMac - Copy a file while preserving metadata and forks (Developer Tools)
copy - Copy groups of files in folders
dd - Data Dump - convert and copy a file (use for RAW
storage)
install - Copy files and set attributes
MvMac - Copy a filewhile preserving metadata and forks (Developer Tools)
tar - store or extract files to an archive (allows symbolic
links to be copied as links)
Equivalent BASH command:
mv - Copy Files