getting the number of files in a certain directory (linux or os x)

This is a quick way to get the number of files in a certain directory.
The following command even counts files potentially existing in subfolders and works as well in Linux as in Mac OS X.

find /home/some/folder -type f | wc -l

Hint: If you’re looking for the number of directories in a certain path of course you can use the option -type -d in your command