2

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.

2

1 Answer 1

1

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

find . -maxdepth 1 -type f | sed 's/.*\.//' | sort | uniq -c
2
  • 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
    – user_3pij
    Jul 22, 2019 at 4:33
  • I've added max depth to the find command. Jul 22, 2019 at 4:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .