We're running an application on RHEL and it is trying to write a mysterious log file to a directory that doesn't exist. I'm trying to determine a find command that could go through each sub-directory in development and mkdir log without creating a recursive indefinite loop in the process. So if my folder structure from a very basic redacted view was similar to:

-dir1
--dir11
--dir12
-dir2
--dir21
--dir22
-dir3
--dir31
--dir32

I would want the end result to be

-dir1
--dir11
---log
--dir12
---log
--log
-dir2
--dir21
---log
--dir22
---log
--log
-dir3
--dir31
---log
--dir32
---log
--log

what bash command could create this structure?

link|improve this question

80% accept rate
feedback

1 Answer

up vote 1 down vote accepted

Assuming your top-level directory is /development:

find /development -type d -print0 | xargs -0 -I {} mkdir {}/log
link|improve this answer
Thanks, in my case, I just found out that find -type d -not -name log -exec mkdir {}/log \; also worked for me. – Scott Sep 13 '11 at 15:57
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.