title: No such file or directory after deleting file , ruby on rails
body: <p>I wrote an code to assign documents to patients:</p>
  
  <pre><code>file = Dir.entries('C:\Sites\what2\uploadnew').reject {|entry| entry == "." || entry == ".."}
  
  file.each do |f|
    a = File.read('C:\Sites\what2\uploadnew' + '/' + f) + f
  
    @patients.each do |patient|
      if [patient.nachnahme, patient.vorname, patient.geburtsdatum].all? {|i| a.include? i }
        first = Patient.find_by_id(patient.id)
        second = first.images.create(:url =&gt; 'C:\Sites\what2\uploadsave' + '/' + f[0..-5] + '.tif')
        File.delete 'C:/Sites/what2/uploadnew/' + f
      end
    end  
  end 
  </code></pre>
  
  <p>Like you can see at the end of the code I delete the file:</p>
  
  <pre><code>File.delete 'C:/Sites/what2/uploadnew/' + f
  </code></pre>
  
  <p>But somehow this causes problems. I get the error:</p>
  
  <pre><code>Errno::ENOENT in DocumentsController#index
  
  No such file or directory - C:/Sites/what2/uploadnew/filename.txt
  </code></pre>
  
  <p>The strange thing is that the command works and ruby really deletes the file. Means that the  file cannot exist! SO why asks ruby for this file?</p>