Ads by ProfitSence

Move Multiple Files Linux

Last Updated on Wednesday 5th Oct 2022

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 to def.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 
mv abc def
ls -F


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.
abc.txt def.txt
mv -n abc.txt def.txt
abc.txt def.txt