B
bilal33
I apologize in advance if this is a stupid question, but this is the
first time I'm playing around with ruby and I'm kinda stuck. Been going
thru the pickaxe as well, but maybe I'm just missing something.
I have the following code
Dir.foreach("c:/") do |temp|
p "#{temp} #{File.expand_path temp}"
p File.directory? "#{File.expand_path temp}"
end
basically, I need to detect which items under my C drive (or any other
folder for that matter) are directories. With the code above, I can't
seem to get this to work. I added the expand path call so that I know
that I am getting the folders correctly.
Am I missing something really obvious here? Why can't I differentiate
between a file and a directory?
I'm using Ruby 184-19 (the one click installer).
Thanks
first time I'm playing around with ruby and I'm kinda stuck. Been going
thru the pickaxe as well, but maybe I'm just missing something.
I have the following code
Dir.foreach("c:/") do |temp|
p "#{temp} #{File.expand_path temp}"
p File.directory? "#{File.expand_path temp}"
end
basically, I need to detect which items under my C drive (or any other
folder for that matter) are directories. With the code above, I can't
seem to get this to work. I added the expand path call so that I know
that I am getting the folders correctly.
Am I missing something really obvious here? Why can't I differentiate
between a file and a directory?
I'm using Ruby 184-19 (the one click installer).
Thanks