开发者

How can I remove temporary folders under Windows with R?

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))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜