From: John Maclean Date: 2006-01-28T23:33:12+09:00 Subject: Re: working with file types and directories OK, next step... I can now run tests on files within directories. How can I achieve something like the following? puts "files have been checked" if Dir.foreach(".") {|x| puts FileTest.writable?(x) } == "true" #at the moment I get this:- irb(main):022:0> puts "files have been checked" if Dir.foreach(".") {|x| puts FileTest.writable?(x) } == "true" true true true true true true #but *not* the desired string "files have been checked" On Sat, 28 Jan 2006 13:16:04 +0900 John Maclean wrote: > This line shows all the files in the current dir. > > This one -should- show all of thier filetypes... > > Dir.foreach(".") {|x| File.ftype x } > => nil > # what gives? > > irb(main):023:0> Dir.foreach(".") {|x| File.ftype(x) } > => nil > > Dir.foreach(".") {|x| File.ftype(#{x})} > # I knew that this wouldn't work, but I tried it anyway > -- John Maclean MSc (DIC) 07739 171 531