Regular expression and reading directories

You could try:

  directory = Dir.open("#{RAILS_ROOT}/public/folder")   @files_and_folders = directory.to_a.select {|i| /(^\..?$)|(.svn $)/.match(i) }