Let us start with a description of your environment:
- which OS are you using (and which version of it)
- which shell are you using (and, maybe, which version of it)
the answers to these questions may well influence the final solution to your problem.
Now, the general solution to your problem is the
find-command: basically it produces a list of files, which (see the
-exec-clause) then can be subjected to some command. For a (short) introduction
see here
I hope this helps.