Hi,

i want to count the occurence of a searchstring in all files
below a directory and all its subdirectories

i have =

matches=0
Dir.glob("E:/test/foobar/scripts/**/**.xml").each do |f|
  matches += File.new(f).read.scan('<if>').size
  puts f
end

puts "Matchcount == " + matches.to_s
puts "Scanned Files == " +
Dir.glob("E:/test/foobar/scripts/**/**.xml").size.to_s

Is there a better way ?

Regards,
Gilbert