在R中删除文件夹及其子文件夹中的文件

itt*_*ill 1 r

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

Ice*_*can 5

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)
Run Code Online (Sandbox Code Playgroud)