我可以使用下面的代码复制文件/子目录,但我只想复制csv文件。
dir.create(new_directory)
file.copy(from = old_directory, to = new_directory, recursive = TRUE)
答案 0 :(得分:1)
这应该有效:
fls <- list.files(pattern='*.csv')
file.copy(fls,
to = "new_directory", recursive = TRUE,
overwrite = TRUE, copy.mode = TRUE, copy.date = FALSE)
答案 1 :(得分:0)
你试过这个吗?
file.copy(from = "old_path/*.csv", to ="new_path/", recursive = TRUE)