Reputation: 777
let's suppose I have a directory structure and I want to create a directory called new
inside each subdirectory recursively.
For instance, If I have
dir1
|
-------dir11
|
-------dir12
|
------dir121
dir2
I want to create new
directories like this:
dir1
|
-------dir11
| |
| -------new
|
-------dir12
| |
| ------dir121
| | |
| | ---------new
| |
| ------new
|
-------new
dir2
|
-------new
Is it possible?
Upvotes: 0
Views: 48
Reputation: 11435
find . -type d ! -name "*new*" -exec mkdir {}/new \;
find all folders. make a folder in that folder called new. don't make folders in folders that have new
in the same (otherwise it'll get dir1/new/new/new/new, etc)
Upvotes: 2