You seem to have the right idea. I’d use -type f
to find only files:
$ find some_directory -type f | wc -l
If you only want files directly under this directory and not to search recursively through subdirectories, you could add the -maxdepth
flag:
$ find some_directory -maxdepth 1 -type f | wc -l