- glob
Ruby list files by using glob
examples/files/glob.rb
if ARGV.length != 1 puts "Usage: #{$0} DIRNAME" exit end dirname = ARGV[0] content = Dir.glob(dirname) print content
ruby examples/files/glob.rb "*.md"
if ARGV.length != 1 puts "Usage: #{$0} DIRNAME" exit end dirname = ARGV[0] content = Dir.glob(dirname) print content
ruby examples/files/glob.rb "*.md"