Gotcha for Newbies

Hi all,

I just thought I’d drop this one in for any newbie’s playing around
with directory listings…

me@somehost> find /somedir > results

File.open("./results").each do |file|
puts file unless File.directory(file)
end

… What do we think the output should be if given that /somedir
contains both directories and files…

And why does this give you a different result…

require ‘find’

Find.find("./results").each do |file|
puts file unless File.directory(file)
end

Yep… probably extrememly obvious to the oldtimers… but drove me
nuts…\n

~Neowulf

Hint: …chomp…

Opps… correction…

require ‘find’

Find.find("./somedir").each do |file|
puts file unless File.directory(file)
end

~Neowulf