Copying list of files from one folder to other in R

前端 未结 2 962
暗喜
暗喜 2020-12-17 15:42

I am trying to bulk move files of different kinds in R.

origindir <- c(\"c:/origindir\")
targetdir <- c(\"c/targetdir\")
filestocopy <- c(\"myfile.         


        
2条回答
  •  暖寄归人
    2020-12-17 16:20

    As Joran and Chase have already pointed out in the comments, all you need to do is:

    file.copy(from=filestocopy, to=targetdir, 
              overwrite = recursive, recursive = FALSE, 
              copy.mode = TRUE)
    

    Then, if you're actually moving the files, remove the originals with:

    file.remove(filestocopy)
    

提交回复
热议问题