Created
December 5, 2019 22:56
-
-
Save planetceres/1404c50ba0ba173e43fa96644a987d88 to your computer and use it in GitHub Desktop.
Count/show file types in recursive tree
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Reference: https://unix.stackexchange.com/a/387631 | |
for d in */ ; do | |
echo $d | |
find $d -type f | sed -r 's/.*\/([^\/]+)/\1/' | sed 's/^[^\.]*$//' | sed -r 's/.*(\.[^\.]+)$/\1/' | sort | uniq -c | sort -nr | |
# files only | keep filename only | no ext -> '' ext | keep part after . (i.e. ext) | count | sort by count desc | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment