Dir.foreach yields *one* name at a time to the block, so using a block 
variable called folder_names(plural) is confusing and therefore should 
be shunned.  In addition, the names that are yielded are known as 
"filenames" regardless of whether they are actually the names of files 
or directories.  Dir.foreach() is defined to yield all the names in a 
directory--files and directories--including hidden files, which are 
filenames whose names start with a dot.

There is a method called Dir.glob() which yields all the filenames in a 
directory--omitting the hidden files by default.  Dir.glob() will also 
return full paths if you give it a full path as the starting point of 
the search.

-- 
Posted via http://www.ruby-forum.com/.