Skip to content

Instantly share code, notes, and snippets.

@campanalbero
Last active August 29, 2015 14:08
Show Gist options
  • Save campanalbero/9cbcc394afb84ffd2096 to your computer and use it in GitHub Desktop.
Save campanalbero/9cbcc394afb84ffd2096 to your computer and use it in GitHub Desktop.
引数フォルダ以下にあるファイルの拡張子を重複なしで表示
require 'set'
set = Set.new()
Dir.glob(File.expand_path(ARGV[0]) + '/**/*') do |f|
if File.ftype(f) == "file"
ext = File.extname(f)
set.add(ext)
end
end
set.each do |item|
puts item
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment