This command will print the *.cpp filenames in the given directory:
find . -name "*.cpp" -print
How can I print both *.cpp and *.h filenames?
An example with more alternatives:
I'll give an example. This will search for files with owner=1000 and write them to "uid.list", search for files with group=1000 and write them to "gid.list" and it will skip paths beginning with /proc, /sys, /dev. The advantage of combined conditions is that filesystem is scanned only once. Here it is: