From: Kyle Barbour Date: 2010-08-03T05:10:04+09:00 Subject: Re: Iteration through File.file? misses entries for which File.file?(entry) == true -- FIXED Thanks for all the responses! I feel so thoroughly helped :) On Aug 2, 7:01 am, Marvin Gülker wrote: > By calling Dir.foreach("dir") you'll get "my_file" and "my_second_file". > Your File.file? statement then checks for the presence of the filenames > in the current working directory -- where they don't reside. Solution: > Append "dir" to the filename. Martin - thanks for the diagnosis, that makes perfect sense. Awesome. That works very well and solves my problem! On Aug 2, 6:05 am, Brian Candler wrote: > As an alternative, Dir["etc/*"] builds an Array directly. So you could > have: > > def get_files(dir) >   Dir["#{dir}/*"].select { |x| File.file?(x) } > end Interesting, thanks! Is there any reason to prefer either this solution or the one Martin gave in the above post? Also: everyone, thanks for the newbie friendliness and for the general advice (snake_case, negative logic, etc.). Thoroughly appreciated. Kyle