Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Count number of specific file type of a directory and its sub dir in mac

I use ls -l *.filetype | wc -l but it can only find files in current directory.
How can I also count all files with specific extension in its sub dirs?
Thank you very much.

like image 916
Xitrum Avatar asked Sep 29 '12 20:09

Xitrum


People also ask

How do I count files in a folder and subfolders?

Use File Explorer Open the folder and select all the subfolders or files either manually or by pressing CTRL+A shortcut. If you choose manually, you can select and omit particular files. You can now see the total count near the left bottom of the window. Repeat the same for the files inside a folder and subfolder too.

How do I count the number of files in a Mac folder?

You can see the file count by enabling Status Bar in Finder. To do this, click View -> Show Status Bar on the menu bar, or press Command + /.


1 Answers

You can do that with find command:

find . -name "*.filetype" | wc -l 
like image 183
P.P Avatar answered Nov 10 '22 03:11

P.P