Get the names of all files in the directory.
d = Dir.open('mydir') d.reject { |f| f[0] == '.' } d.rewind d.reject { |f| !File.file? File.join(d.path, f) } d.close