I have been trying to move some files from a folder to another based on a filename list by writing these codes
inputdir <- dir('original/folder/of/the/files')
targetdir <- dir('target/folder/of/the/files')
filestocopy <- c('file1.csv', 'file2.csv', file3.csv', ...)
lapply(filestocopy, function(x) file.copy(paste (inputdir, x , sep = "/"),
paste (targetdir,x, sep = "/"), recursive = TRUE, copy.mode = TRUE))
But I keep receiving this error:
Error in file.copy(paste(inputdir, x, sep = "/"), paste(targetdir, x, :
more 'from' files than 'to' files
I hope to receive some help about this. Many thanks!
1