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.

How to find using bash folders which dosen't exist in second level of the specified directory?

I have structure like:

- a
-- aa
--- aaa
---- myfolder <- if this folder dosen't exist I need to know that
-- ab
--- abc
---- myfolder <- if this folder dosen't exist I need to know that

I need to find in every "a" second level subfolder, folders "myfolder" that dosen't exist. Can you help?

share|improve this question
1  
See stackoverflow.com/questions/59838/… –  Hennes Dec 30 '12 at 22:35
    
What have you tried? –  F. Hauri Jan 2 '13 at 9:29
    
I did regular while loop –  Tuner Jan 5 '13 at 16:12

1 Answer 1

You should be able to do something with find and test e.g.

find /path/to/search -type d \! -exec test -e '{}/myfolder' \; -print

or

find  /path/to/search -maxdepth 1 -type d  \! -exec test -d '{}/myfolder' \; -print

it's late, the wine has been nice, your use case isn't clear - hic

share|improve this answer

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.