Ubuntu – Count total number of files in particular directory with specific extension

command linels

I want to count the total number of files in particular directory that ends with ".mp4" extension.

I am getting following command:

ls -F |grep -v / | wc -l

It count all the files in particular directory, but I want the count of files that end with .mp4 extension.

Is there any Ubuntu command for that?

Best Answer

Here you can do this way

ls -lR /path/to/dir/*.jpg | wc -l

This gives you count