【问题标题】:Deleting files in folder and its sub folders in R在R中删除文件夹及其子文件夹中的文件
【发布时间】:2019-02-16 05:46:48
【问题描述】:

在 R 中,我试图删除文件夹及其子文件夹中的所有文件。但是,我想保持文件夹完好无损。最有效的方法是什么?

【问题讨论】:

标签: r


【解决方案1】:
fold <- 'C:/some/path/here'

# get all files in the directories, recursively
f <- list.files(fold, include.dirs = F, full.names = T, recursive = T)
# remove the files
file.remove(f)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-07-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多