21/12/07 13:32:14.96 lMfMxSoR0.net
>>352
Ruby では、glob に拡張子も指定できる
# 絶対パスのディレクトリ名の後ろに、*.txt を付ける。
# . で始まる、隠し directory, file を除く
glob_pattern = "C:/Users/Owner/Documents/**/*.txt"
separator = "-" * 30 + "\n"
Dir.glob( glob_pattern )
.select { |full_path| File.file?( full_path ) } # ファイルのみ
.each do |full_path|
puts "#{ separator }#{ full_path }\n#{ separator }" + File.read( full_path )
end