'How move files based on file names in R?
I know the question was asked many times but still i'm copying empty file. let's assume i have 50000k files and i have around 3000 file names as a vector so i want to move the files to different folder based on their names.
for (i in files) {
for (j in files_names) {
if ( i == j){
file_copy(i, "C:/copy/to_this_folder")
}
}
}
But it moves the files but all of them were 0KB. Can any one please explain this to me
Solution 1:[1]
Does this work for you?
letters
x = c("a", "b", "c", "2")
for (name in x[x %in% letters]) {
file.copy(name, "tmp/")
}
Also, remember to use getwd() to check whether your working directory is correct or not.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | deadfate-sky |
