title: No such file or directory @ rb_sysopen ruby
body: <p>Facing below issue eventhough the file is present in the folder.</p>
  
  <pre><code>H:\Ruby_test_works&gt;ruby hurrah.rb
  hurrah.rb:7:in `read': No such file or directory @ rb_sysopen - H:/Ruby_
  test_works/SVNFolders.txt (Errno::ENOENT)
          from hurrah.rb:7:in `block in &lt;main&gt;'
          from hurrah.rb:4:in `each_line'
          from hurrah.rb:4:in `&lt;main&gt;'
  </code></pre>
  
  <p>Input file (input.txt) Columns are tab separated.</p>
  
  <pre><code>10.3.2.021.asd  10.3.2.041.def  SVNFolders.txt
  SubversionNotify    Subversionweelta    post-commit.bat
  Commit message  still rake  customemail.txt
  mckechney.com   yahoo.in    ReadMe.txt
  </code></pre>
  
  <p>Code : </p>
  
  <pre><code>dir = 'H:/Ruby_test_works'
  file = File.open("#{dir}/input.txt", "r")
  
  file.each_line do |line|
    initial, final, file_name = line.split("\t")
    #puts file_name
    old_value = File.read("#{dir}/#{file_name}")
  
    replace = old_value.gsub( /#{Regexp.escape(initial)}, #{Regexp.escape(final)}/)
    File.open("#{dir}/#{file_name}", "w") { |fi| fi.puts replace }
  
  end
  </code></pre>
  
  <p>I have tried using both forward and backward slashes but no luck. What I'm missing, not sure. Thanks.</p>
  
  <p><code>puts file_name</code> gives the below values</p>
  
  <pre><code>SVNFolders.txt
  post-commit.bat
  customemail.txt
  ReadMe.txt
  </code></pre>