Unix move multiple files
- The
mv
command is a command line utility that moves files or directories from one place to another . - It supports moving single files, multiple files and directories.
Move Multiple Files Linux
- To move a file using the
mv
command pass the name of the file and then the new name for the file. - In the following example the file
abc.txt
is renamed todef.txt
.
mv abc.txt def.txt
Linux Move Multiple Files
To move a directory using the mv command pass the name of the directory to move followed by the destination.
ls -F abc/ mv abc def ls -F def/
How to Move Multiple Files in Linux
To move multiple files using the mv
command pass the names of the files.
mv file1.txt file.2.txt file3.txt folder
Not overwrite an existing file
- To prevent an existing file from being overwritten pass the
-n
option. - This causes the
mv
command to ignore anything that would overwrite an existing file.
ls abc.txt def.txt mv -n abc.txt def.txt ls abc.txt def.txt