Newbie wrote:
> def traverse(root)
>    Dir.foreach(root) do |file|

You can use Dir #[], #glob, or #entries also. If you use a glob or the
entries method, you can also automatically skip the . and .. --
Dir.entries(root)[2..-1] will give you an array of all the files and
subdirs in root, minus the first two (which are always . and ..) If you
do that, you can skip the next line.

Check out the docs to see how to use them further:
http://ruby-doc.org/core/classes/Dir.html

>      next if file[0] == ?.

This will probably work for most cases in windows (though not always),
but it definitely a bad idea for any other OS (because filenames can
start with a . to mean they should be hidden in normal listing modes).
What I usually use is -- next if ['.', '..'].include? file -- which
checks if the full filename == '.' or '..'

>      puts file
>      traverse(root + '\\' + file) if File.directory?(root + '\\' + file)

This is also not very portable. Better to use File.join(root, file)

>    end
> end

Ps. Your directory traverser looks ALOT better than my first one did!

HTH,
Jordan