1

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?

Scott
  • 397
  • 1
  • 4
  • 14

1 Answers1

1

Assuming your top-level directory is /development:

find /development -type d -print0 | xargs -0 -I {} mkdir {}/log
ThatGraemeGuy
  • 15,314
  • 12
  • 51
  • 78
  • 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