Get all contents other than ".", "..", and hidden files. : Dir.reject « File Directory « Ruby






Get all contents other than ".", "..", and hidden files.


d = Dir.open('mydir')
d.reject { |f| f[0] == '.' }
d.close

 

Related examples in the same category

1.Get the names of all files in the directory.