Hua*_*hen 17
将当前目录文件复制到新目录
currentfiles是要复制的文件列表
newlocation是您要复制到的目录
如果您没有列出当前文件,则需要遍历您的工作目录
file.copy(from=currentfiles, to=newlocation,
overwrite = TRUE, recursive = FALSE,
copy.mode = TRUE)
Run Code Online (Sandbox Code Playgroud)
这是为了删除旧文件
file.remove(currentfiles)
Run Code Online (Sandbox Code Playgroud)
我迟到了。这是我完成工作的简单方法。在R中
current_folder <- "C:/Users/Bhabani2077/Desktop/Current"
new_folder <- "C:/Users/Bhabani2077/Desktop/Ins"
list_of_files <- list.files(current_folder, ".py$")
# ".py$" is the type of file you want to copy. Remove if copying all types of files.
file.copy(file.path(current_folder,list_of_files), new_folder)
Run Code Online (Sandbox Code Playgroud)