I'm trying to use the find command to generate a list of source files within a directory and only some of its subdirectories. Example:
/Source_Files /dontexclude dontexclude.h dontexclude.c /exclude exclude.c exclude.h main.c test.c test.h
I want a list of files ending in '.c' and '.h', and I want to exclude the contents of the /exclude subdirectory.
find -name '*.c' -o -name '*.h' -o -path '*/exclude' -prune produces this output:
./test.h ./exclude ./test.c ./main.c ./dontexclude/dontexclude.c ./dontexclude/dontexclude.h
How can I use
find to produce the above list without "./exclude"?