From: Yu Yu Date: 2011-08-19T05:47:52+09:00 Subject: Re: Searching in a directory First of all thank you very much for help. I want to search in all .txt files of a folder for a string and when I find this string, then i call a function_1. If there's no string, I call a function_2. Later the string will be dynamic, but that's not important now. I took the code from Josh and tried a bit, but there's still a mistake concerning reading the whole file. Dir["**/*.txt"].each do |filename| if File.readlines(filename).include?("123"+"string") then puts("function_1") else puts("function_2") end end -- Posted via http://www.ruby-forum.com/.