genesst
genesst

Reputation: 1431

Show and count all file extensions in directory (with subdirectories)

I'm using command from this topic to view all file extensions in directory and all subdirectories.

find . -type f -name '*.*' | sed 's|.*\.||' | sort -u

How do I can count number of appearance for each extension?

Like:

png: 140

Upvotes: 3

Views: 821

Answers (1)

Robby Cornelissen
Robby Cornelissen

Reputation: 97247

Like this, using uniq with the -c, --count flag:

find . -type f -name '*.*' | sed 's|.*\.||' | sort | uniq -c

Upvotes: 5

Related Questions