My system is "win7", and I want to delete the file "workspace".
file.remove("c:\\workspace")
# [1] FALSE
# Warning message:
# In file.remove("c:\\workspace") :
# cannot remove file 'c:\workspace', reason 'Permission denied'
How can I give the R the power to delete it?
file.info("c:\\workspace")
# size isdir mode mtime ctime
# c:\\workspace 0 TRUE 777 2014-01-01 14:42:51 2014-01-01 14:33:27
# atime exe
# c:\\workspace 2014-02-25 09:39:08 no
@TypeIA answered it in a comment, but I'll formalize it here: help(unlink)
.
file.create('somefile')
# [1] TRUE
file.remove('somefile')
# [1] TRUE
dir.create('somedir')
file.remove('somedir')
# [1] FALSE
# Warning message:
# In file.remove("somedir") :
# cannot remove file 'somedir', reason 'Permission denied'
unlink('somedir', recursive=TRUE)
(The directory is gone.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With