1

I've about 0.1 million images in a directory with all kinds of extensions (gif, jpeg, png, tiff, etc).

Now I want to find out how many types (of extensions) are there in the current directory, possibly with total number of images associated with them using a terminal command, something like this:

some-command

png  - 11010
jpeg - 1134
jpg  - 145
tiff - 555

P.S: I do not want to count files with specific extension but rather want to count types of extensions with their associated files.

0

The duplicate candidate (deep down) has a close answer. Here it is modified:

find . -maxdepth 1 -type f | sed 's/.*\.//' | sort | uniq -c
  • One problem here. It's also finding files in sub-directories and I neither wish to count files in them nor want to move them because there's a lot of images in them. And I'll be grateful if you can tell what this command is doing so that I can exploit it in my way if I want to – Naeem Jul 22 at 4:33
  • I've added max depth to the find command. – WinEunuuchs2Unix Jul 22 at 4:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.