Sunday, October 08, 2006

Linux : Finding unique types of files

Here's a quick way to figure out what different file-types (based on extension) you have. The following example checks the working directory. A hash of extensions is used in the perl code that appears in single quotes.

find . -name "*.*" | perl -e 'while(<>){$ext{$1}++ if(/\.([\w]+)$/);} $,="\n"; print sort keys %ext;'

Do you find this useful ?

No comments: