Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Could someone please help me to find all the *.c and *.h files in a directory tree??

share|improve this question

2 Answers 2

up vote 6 down vote accepted
find . -name '*.[ch]' -type f 

*.[ch] represents all *.h and *.c files, -type f finds regular files.

P.S. You might want to accept answers for your other questions :)

share|improve this answer
    
it is works for me :) but why you said You might want to accept answers for your other questions..I couldnt get it ..maybe my english is not good enough. –  Eli Sep 29 '11 at 16:33
1  
@Eli In your questions, choose the best answer and click on the tick mark next to it. If you don't do this, your accept rate will drop to 0% and will deter people from answering your questions. –  Jin Sep 29 '11 at 16:38

If you are at the top of the directory tree.

find . -name *.c -print

would find all the .c files located below the current "." directory.

Lot's more help can be find by searching "unix find command".

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.