Created
October 30, 2014 10:00
-
-
Save campanalbero/14cda6ace0e3719e701f to your computer and use it in GitHub Desktop.
引数で指定するフォルダ以下のファイルの拡張子毎にパスを出力する
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
hash = Hash.new() | |
Dir.glob(File.expand_path(ARGV[0]) + '/**/*') do |f| | |
if File.ftype(f) == "file" | |
ext = File.extname(f) | |
arr = hash[ext] | |
if arr == nil | |
arr = Array.new() | |
end | |
hash.store(ext, arr.push(f)) | |
end | |
end | |
hash.each do |key, value| | |
puts "" | |
puts key | |
value.each do |item| | |
puts item | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment