Automatically Delete Files/Folders

Solution 1:

Maybe you're just looking for a combination of file.remove and list.files? Maybe something like:

do.call(file.remove, list(list.files("C:/Temp", full.names = TRUE)))

And I guess you can filter the list of files down to those whose names match a certain pattern using grep or grepl, no?

Solution 2:

For all files in a known path you can:

unlink("path/*")