0

I already checked several question on SO. This questions is different because asks to delete several files based on paths stored in a vector.

I have a vector:

rds_files <- paste0("C://mypath//file", 1:10, ".rds")

Each element of the vector represent the path of a file I need to delete.

Can you suggest me one of the possible approaches to automatically delete all those files?

Seymour
  • 3,104
  • 2
  • 22
  • 46
  • I already checked some questions on SO. This is different because it asks to delete based on path stored in a vector – Seymour Mar 24 '18 at 10:24
  • In the dupe link suppose you assign it `files <- list.files("C:/Temp", full.names = TRUE))` it will again do the same thing `do.call(file.remove, list(files))` – akrun Mar 24 '18 at 10:26
  • 1
    Solution in linked question works for me: `for (i in 1:10) {saveRDS(1, paste0("file", i, ".RDS"))}; rds_files <- paste0("file", 1:10, ".rds"); do.call(file.remove, list(rds_files))` – pogibas Mar 24 '18 at 10:34
  • Clear, thank you for help! – Seymour Mar 24 '18 at 10:38

0 Answers0