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

link|improve this question
feedback

2 Answers

up vote 3 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 :)

link|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
feedback

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".

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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