Search code examples
rtemp

Is Windows 10 or R itself deleting my temp directory?


I saw the info on finding the name of my temp directory in this question.

The problem I'm having is that my Appdata/Local/temp/[Rtmpxxxx] directory is being deleted during an R session longer than 1 or 2 days. I have turned off all automatic temp deletion actions that Windows 10 can take. There's nothing in Rprofile.site or .Renviron related to temp directory or files.

Any ideas what I need to turn off or modify to keep the Rtmp directory from being deleted?


Solution

  • You could move your temp directory to another folder (outside the win10 temp folder) e.g. with write("TMP = '<your-desired-tempdir>'", file=file.path(Sys.getenv('R_USER'), '.Renviron'))

    If it is still being deleted, it is rather unlikely that Win10 deletes it.

    edit by the OP

    Depending on [something mysterious], the same command above should be used to create TEMP and TMPDIR as discussed here