I’ve been using tempfile.mkdtemp with a prefix to create my temp files. This results in a lot of different directory in my tmp folder with ‘tmp/myprefix{uniq-string}/‘.
I would like to change this and have a subdirectory so that my the temp folders I create are all under one main directory so that the prefix is actually a subfolder of tmp ‘tmp/myprefix/{uniq-string}/‘.
Also, I don’t want to override tempfile‘s system for defining a default tmp directory.
I tried playing with the ‘prefix‘ and ‘dir‘ parameters but with no success.
To use the dir argument you have to ensure the dir folder exists. Something like this should work: