ls | wc -l

If you want a little more control over what you’re counting, you can use:

find DIR_NAME -type f | wc -l