rm recursive file pattern

C++
find . -name "*.bak" -type f -delete# print all files recursively with exstension .bak
find . -name "*.bak" -type f

# add -delete command at the end to delete them
find . -name "*.bak" -type f -deletefind . -type f -name '*.o' -delete
Source

Also in C++: