Now the Dir object is useless until we call Dir#rewind.
d = Dir.open('mydir') d.reject { |f| f[0] == '.' } d.entries.size # => 0 d.rewind d.entries.size # => 6 d.close