Copy folders from one directory to another in R

前端 未结 3 1363
孤独总比滥情好
孤独总比滥情好 2021-02-18 13:06

I have two folders (say \"A\",\"B\") which are in a folder (say \"Input\"). I want to copy \"A\" and \"B\" to another folder (say \"Output\"). Can I do this in R?

3条回答
  •  青春惊慌失措
    2021-02-18 14:01

    Copying your current directory files to their new directories

    currentfiles is a list of files you want to copy newlocation is the directory you're copying to

    If you aren't listing your current files, you'll need to loop through you're working directory

    file.copy(from=currentfiles, to=newlocation, 
              overwrite = TRUE, recursive = FALSE, 
              copy.mode = TRUE)
    

    This is for deleting your old files

    file.remove(currentfiles)
    

提交回复
热议问题