On a Linux machine I would like to traverse a folder hierarchy and get a list of all of the distinct file extensions within it.
What would be the best way to achieve this from a shell?
On a Linux machine I would like to traverse a folder hierarchy and get a list of all of the distinct file extensions within it.
What would be the best way to achieve this from a shell?
Powershell:
Thanks to http://kevin-berridge.blogspot.com/2007/11/windows-powershell.html
I don't think this one was mentioned yet:
Recursive version:
If you want totals (how may times the extension was seen):
Non-recursive (single folder):
I've based this upon this forum post, credit should go there.
Find everythin with a dot and show only the suffix.
if you know all suffix have 3 characters then
or with sed shows all suffixes with one to four characters. Change {1,4} to the range of characters you are expecting in the suffix.
Try this (not sure if it's the best way, but it works):
It work as following:
you could also do this