Moving All Files From Directories One Step Up Moving All Files From Directories One Step Up linux linux

Moving All Files From Directories One Step Up


The typical way of moving files all files matching a particular expression is

mv 1/*.masked targetDir

where targetDir could be ..

If you want to move it from directories 1,2,3 then you can do something like

mv */*.masked targetDir

Or, if you want to specifically move it from numbered directories, you can just run something like

mv [0-9][0-9]/*.masked targetDir


Many unix shells support the * operator in the directory portion of the path as well. The following works in at least bash and zsh:

ls */*.masked

This will return all of the files that end in .masked one directory deeper.

So to move them:

mv */*.masked destination