title: R - file.copy function
body: <p>As part of a larger script, I need to move all &lt;.csv> files from one directory to another. I wrote a simple script to do it, and was working fine, but for some reason, it is not working now, and I am going nuts trying to figure out what I'm doing wrong.</p>
  
  <p>The code is:</p>
  
  <pre><code>rawPath &lt;- "./test_dir1"
  dataPath &lt;- "./test_dir2"
  
  dataFiles &lt;- dir(rawPath, "*.csv", ignore.case = TRUE, all.files = TRUE)
  file.copy(dataFiles, dataPath, overwrite = TRUE )
  </code></pre>
  
  <p>But I get the following error:</p>
  
  <blockquote>
    <p>Warning messages:
    <code>1: In file.copy(dataFiles, dataPath, overwrite = TRUE) :
      problem copying .\test_dir1\11085.lis.csv to C:\Users\Desktop\test_dir2\11085.lis.csv: No such file or directory</code></p>
  </blockquote>
  
  <p><code>One error message for each file</code></p>
  
  <p>Please, find trial directories and files that are a simplified version of what I have in the following link:
  <a href="https://www.dropbox.com/sh/7eqvyugc472w19i/AACIjlytbB4s55X0Ga1hmKQka?dl=0" rel="noreferrer">https://www.dropbox.com/sh/7eqvyugc472w19i/AACIjlytbB4s55X0Ga1hmKQka?dl=0</a></p>
  
  <p>Any help would be appreciated. Thanks!</p>