For most recursive file operations, you want to use find
, as the other answers explain.
There is an example of a recursive bash script included in the bash-doc package. If you've got those examples installed, it will be at /usr/share/doc/bash/examples/functions/recurse
(on Debian).