Search code examples
rtemp

How to create multiple tempdirs in a single R session?


I need to create multiple temp directories during a single R session but every time I call tempdir() I get the same directory.

Is there an easy way to ensure that every call will give me a new temp directory?


Solution

  • Use dir.create(tempfile()) to create a uniquely named directory inside the R temporary directory. Repeat as necessary.