In R I am trying to delete all the files in a folder and its sub folders. However, I want to keep the folders intact. What would be the most efficient way to do it?
Asked
Active
Viewed 6,260 times
1 Answers
8
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)

IceCreamToucan
- 28,083
- 2
- 22
- 38