I am trying to read keywords and phrases from a .txt file and run these
words against a given directory structure. I seem to be having a few
problems, when I run my code i get the following error:
C:\Documents and Settings\user\Desktop>keywordsearch.rb “C:\Documents
and Sett
ings\user”
C:/Documents and Settings/user/Desktop/keywordsearch.rb:21:in
`initialize’: No
such file or directory - C:\Documents and
Settings\user\Desktop\terms.txt (Er
rno::ENOENT)
I cannot see what is wrong with my code see below:
File.open(curPath) do |file|
file.each do |line|
o = File.open(“C:\Documents and
Settings\user\Desktop\terms.txt”)
terms = o.readlines
terms.each do |term|
if line =~ term
puts “#{curPath}”
end
end
o.close
end
end
Any ideas, I really appreciate the guidance.
Regards