Created
December 20, 2012 18:21
-
-
Save davidoram/4347454 to your computer and use it in GitHub Desktop.
Output a list of the unique file extensions in the current directory and all subdirectories, lowercased and sorted
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
| #!/bin/ruby | |
| # Output a list of the unique file extensions in this directory and all subdirectories | |
| # lowercased and sorted | |
| extensions = {} | |
| Dir.glob('**/*') do |f| | |
| ext = File.extname(f).downcase | |
| extensions[ext] = ext if ext | |
| end | |
| puts extensions.keys.sort |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment