How to move multiple files between folders in terminal?

8.3k Views Asked by At

How I can select all files in a directory and move them to another folder?

i have such directory: folder1/folder2/ [many different files here]

mv folder1 file3 - in this case only one file3 is moving in folder1

But i want to select all files in folder 2.

I try to print:

  • /..
  • ./* -whis -ls -other ways whis *
2

There are 2 best solutions below

4
Xershy On BEST ANSWER

The 'mv' command to move files does support wildcard characters. Simply use mv folder1/folder2/* <destination>.

This command will move all files in folder1/folder2 to your specified destination.

0
deadmanIsARabbit On

If you really only want to move files and not folders within folder2 do this:

find /PATH/TO/FOLDER1/FOLDER2 -type f -exec mv {} /PATH/TO/DESTINATION/FOLDER/ \;

This will find all files in folder2 and move them to your new destination

/E: Other folders within folder2 will not be moved