Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R move whole folder to another directory

Tags:

directory

r

move

I would like to move the whole folder from one directory to another, this is my code,

folder_old_path = "C:/Users/abc/Downloads/managerA"
path_new = "C:/User/abc/Desktop/managerA"
current_files = list.files(folder_old_path, full.names = TRUE)
file.copy(from = current_files, to = path_new, 
          overwrite = recursive, recursive = FALSE, copy.mode = TRUE)

However, I am getting this error msg

Error in file.copy(from = current_files, to = path_new, overwrite = recursive, : more 'from' files than 'to' files

any idea how to fix this? thank you so much for your help!

like image 224
C_Mu Avatar asked Oct 03 '18 21:10

C_Mu


1 Answers

library(ff)
from <- "~/Path1/"            #Current path of your folder
to   <- "~/Path2/"            #Path you want to move it.
path1 <- paste0(from,"NameOfMyFolder")
path2 <- paste0(to,"NameOfMyFolder")
file.move(path1,path2)

Try using this little code.

like image 196
alebj88 Avatar answered Sep 27 '22 22:09

alebj88