I recently needed to count the number of files, not including directories, within a given directory. Additionally, I wanted to count recursively.
On FreeBSD or Linux, you can do this with the following commands:
$ find /path/to/dir -type f | wc -l
Pretty handy!
-Chris