Last active
October 29, 2015 04:24
-
-
Save alexey-m-ukolov/8194a7a7f4c131292266 to your computer and use it in GitHub Desktop.
Get all extensions and their respective file count in a directory
This file contains hidden or 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
#SOURCE | |
http://serverfault.com/questions/183431/get-all-extensions-and-their-respective-file-count-in-a-directory | |
sudo find ./ -type f | grep -E ".*\.[a-zA-Z0-9]*$" | sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/' | sort | uniq -c | sort -n | |
#EXPLANATION: | |
# find only file, not directory | |
find ./ -type f | |
# filter file with extension | |
grep -E ".*\.[a-zA-Z0-9]*$" | |
# delete path and file name, save only extension | |
sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/' | |
# sort, uniq and sort | |
sort | uniq -c | sort -n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment