After a session I would like to clean up my temporary folders, like for instance
d <- tempfile()
d开发者_开发百科ir.create(d)
setwd(d)
# now work and sweave and latex etc
How can I remove d
and its elements? file.remove
fails.
Try unlink("d", recursive=TRUE)
. That should delete the folder and its contents.
Try ?unlink
. Depends on what os you are using but this:
unlink(d, recursive=TRUE)
Should work. If you want to delete the contents and reuse the folder you could try this:
file.remove(dir(d, full.names=TRUE))
精彩评论