From: Newbie Date: 2006-09-21T18:10:23+09:00 Subject: How to Traverse a Directory def traverse(root) Dir.foreach(root) do |file| next if file[0] == ?. puts file traverse(root + '\\' + file) if File.directory?(root + '\\' + file) end end This is my initial attempt. Two things feel rather wrong: 1) Is there a simpler way to test the beginning of a string? A startsWith?(aString) like method? 2) I'm iterating through filenames, then appending the path each time. Is there a way to get a collection of File objects from a directory? Any other pointers to where I could improve would also be greatly appreciated. (I tried posting this twice through Teranews, but it doesn't seem to have got through.)