0

Building on the question that was answered here about using file.rename in R to move a single file from ond folder to another, is there a way to build a looping function in R that would move all (multiple) files from one folder to another existing folder without having to explicitly name all of the indivdual files?

If possible, I would like to keep the original folder intact so I can start to fill it with fresh files after moving the old ones.

Thanks!

Community
  • 1
  • 1
bshelt141
  • 1,183
  • 15
  • 31

1 Answers1

0

There is lots of questions in that directions; here is one of them Looping through all files in directory in R, applying multiple commands but even that one is marked as a duplicate. The idea is to use list.files - potentially with the "pattern" argument to only grab files of a certain name or type. Yo copy files you could look into file.copy under ?file.copy

Community
  • 1
  • 1
Michael Kaiser
  • 133
  • 1
  • 9