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.

on an unix shell, how can i find all directories with a certain name?

say i have a folder structure like

/home/abcd/foo/
/home/abcd/foo/bar
/home/xyz/ab/foo/
/home/none/in/here

and i am searching for folders named foo, i would want to return a list like:

/home/abcd/foo/
/home/xyz/ab/foo/

how could i do this?

thanks

share|improve this question
add comment

1 Answer

find /home -name foo -type d
share|improve this answer
    
Which means (as a matter of education): print out the paths of all items beneath the directory /home that both have the name foo and are directories (-type d) –  Slartibartfast Jul 11 '10 at 2:29
    
thanks :) that worked ;) –  tarnoob Jul 14 '10 at 18:38
    
@tarnoob: You're welcome. You can mark this answer as accepted then. –  Dennis Williamson Jul 15 '10 at 0:21
add comment

Your Answer

 
discard

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