title: r copy outside of wd based on a list
body: <p>I am trying to do a very similar thing to others but outside of the working directory which I don't want to change every time I run this particular function.  </p>
  
  <p>but based on a list held in a .txt file held in dir1 for example. </p>
  
  <p>here's my copy function. I have read others posts but can't get them to work when there is more  than 1 .txt file in the original directory</p>
  
  <pre><code>#sp6
  current.folder &lt;- "test1"
  new.folder6 &lt;- "test2"
  
  #clear file list 
  list_of_files6&lt;-NULL
  
  # find the files that you want
  list_of_files6 &lt;- read.delim("Mp20181111.txt", header = F)
  
  print(list_of_files6)
  
  setwd(current.folder) 
  for(i in list_of_files6)
  {
    file.copy(i, new.folder6)
  }
  </code></pre>