From: Zion hardes Date: 2010-01-20T18:23:37+09:00 Subject: Re: help on a script --00032555e4320372c9047d952422 Content-Type: text/plain; charset=ISO-8859-1 exclude . and .. in directories On Wed, Jan 20, 2010 at 5:19 PM, Ruby Newbee wrote: > 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 > > --00032555e4320372c9047d952422--