From: Kyle Barbour Date: 2010-08-02T21:30:21+09:00 Subject: Iteration through File.file? misses entries for which File.file?(entry) == true Hello everyone, I'm new to Ruby, so I'm most likely making an elementary mistake. However, searching Google didn't help me find my answer, and after mucking around with irb I still haven't figured it out. I wrote a method that was intended to take all of the files in a given directory and put them into an array. Here's the code I wrote: def getFiles(dir) pwdFiles = Array.new Dir.foreach(dir) do |entry| pwdFiles.push(entry) if File.file?(entry) == true end end This works fine when called on the working directory --- that is, getFiles(Dir.pwd). However, when I call it on a subdirectory --- for example, getFiles("doc") --- it only returns one file. I tested to make sure that the files being ignored in the subdirectory actually gave "true" when tested with File.file?(entry), which they do. Anyone know what I'm doing wrong? Kyle