Created
September 24, 2012 14:06
-
-
Save drasch/3776118 to your computer and use it in GitHub Desktop.
Count files by extensicount-files-by-extension.rbon
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
require 'rubygems' | |
require 'activesupport' | |
ct = Hash.new(0) | |
while gets | |
ma = $_.match %r/\.(\w{2,10})$/ | |
ct[ma[1]] += 1 if ma | |
end | |
y ActiveSupport::OrderedHash[ct.sort_by {|k,v| v}].reject {|k,v| v<50} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Purpose
Count files by certain extensions so I could exclude them in the CtrlP plugin for Vim.
By default, this will show you all extensions with > 50 instances in your tree.
Usage
$ find | ruby count-files-by-extension.rb