title: Copy files which matches requirement to the new folder
body: <p>I have original folder with 2000 files (<code>patha</code>), now I want to copy only the file which match my requirement (list in <code>grdc_no</code>) to new path (<code>pathb</code>). Here is my performance:</p>
  
  <pre><code>grdc_no &lt;- grdc$grdc_no       
  # list of file name satisfied with my requirement
  
  all_files &lt;- list.files("patha", full.names = TRUE)
  
  for (f in all_files) {
  
    for (i in 1:length(grdc_no)) {
  
      if (f == grdc_no[i]) {
        file.copy(f, "pathb")
      } else {}
    }
  }
  </code></pre>
  
  <p>However, it does not work. Any advice for me in this case? Many thanks</p>