Can mv command move multiple files?

QuestionsQuestions8 SkillsProBasic Files OperationsSep, 03 2025
0233

Yes, the mv command can move multiple files at once. You can specify multiple source files followed by the destination directory. The syntax is as follows:

mv file1 file2 file3 destination_directory/

Example:

If you want to move file1.txt, file2.txt, and file3.txt to a directory called archive, you would use:

mv file1.txt file2.txt file3.txt archive/

Notes:

  • Ensure that the destination directory exists; otherwise, the command will fail.
  • You can also use wildcards to move multiple files that match a pattern. For example, to move all .txt files:
mv *.txt archive/

This command moves all text files in the current directory to the archive directory.

0 Comments

no data
Be the first to share your comment!