Counting number of files in a directory with an OSX terminal command

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

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)