Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Assuming your top-level directory is /development:

find /development -type d -print0 | xargs -0 -I {} mkdir {}/log
share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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