Platinum Partner

Howmany


#!/usr/bin/perl
#==========================================================================================
# howmany -- a tool for determining how many different types of files are in a folder
#------------------------------------------------------------------------------------------
# Author: Elliot Winkler 
# Created: 11 Mar 2008
#==========================================================================================

my $dir = $ARGV[0] || ".";
my $cmd = "find $dir";
my @listing = sort grep { $_ } split /\n/, `$cmd`;

my %exts;
for (@listing) {
  my($ext) = /\.([a-z]+)$/;
  next unless $ext;
  $exts{lc $ext}++;
}

for (sort keys %exts) {
  print uc($_).": ".$exts{$_}."\n";
}

Example:
$ cd ~/docs
$ howmany
CSV: 3
DOC: 1
KEY: 1
PUB: 1
SQL: 1
TEXT: 1
TXT: 9
XCF: 2
XLS: 1
ZIP: 1
$ howmany ~/docs
CSV: 3
DOC: 1
KEY: 1
PUB: 1
SQL: 1
TEXT: 1
TXT: 9
XCF: 2
XLS: 1
ZIP: 1
Note: This only works on Linux/Unix, because it relies on a Linux/Unix-only command to pull up the list of files. A future update may include support for Windows, though it would be pretty easy to find out how to fix it.
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}