From: Ruby Newbee Date: 2010-01-20T17:19:32+09:00 Subject: help on a script Hi, I just wrote a small script to find the files in current directory and its child directories which include the word "ruby". But it can't work, please help point out my error, thanks. def myfind(path=".") Dir.foreach(path) do |f| if File.file? f open(f) do |c| puts "#{path}/#{f}" if c.read.scan(/ruby/) end elsif File.directory? f newpath = File.join path,f myfind(newpath) end end end myfind