From: Yu Yu Date: 2011-08-20T04:27:21+09:00 Subject: Re: Searching in a directory Hello, I still have problems and need your help! I forgot to say that the algorithm should search the next string if the actual string was found in one .txt file. The reason is that there're some strings double. This is my code, taken from 7stud: dir_path = 'c:/temp' str = "string" Dir.chdir(dir_path) do Dir.glob("*.txt") do |filename| IO.foreach(filename) do |line| if line =~ /#{str}/ puts "#{filename}: #{str}" end end end end -- Posted via http://www.ruby-forum.com/.