How to Move (mv) Multiple Directories or Files to a Folder at a Time

(Lisa Mathew) #1

There are scenarios where you might want to move multiple directories or files to a folder at once.

You can do this using -t flag with the mv command.

The syntax would look like the following.

mv -t <destination> <src1> <src2> .... <srnN>

You can do that in the reverse fashion as well.

mv file1 file2 file3 -t DESTINATION

For example, if you want to move folder1, folder2, folder3 to folder4, you can use the following comand.

mv -t folder4 folder3 folder2 folder1

You Might Like: Complete Linux course: Become a Linux professional

Moving Files using wildcards

If can also move files using wildcards.

For example

mv *.xml  /path/to/destination-folder