NaviServer Built-in Commands – 5.2.0a
ns_mkdtemp - Make a unique temporary directory
This command is a wrapper around the POSIX mkdtemp(3) function in the C standard library, or a NaviServer callback function, in case it is not available. This function generates a unique temporary directoryfrom an optional template.
This command generates a unique temporary directory using optionally a template as argument, which is a string whose last six characters must be XXXXXX, and returns a new string where those are replaced with random characters such as to make the string a unique directory entry.
If this command is called without the optional parameter it behaves like
ns_mkdtemp [ns_config ns/parameters tmpdir]/nsd-XXXXXX
If the directory cannot be created, the command raises a Tcl error with the operating system's error description. This applies to both the default and explicit templates.
Don't forget to delete the directory when not needed anymore.
% ns_mkdtemp /tmp/foo-XXXXXX /tmp/foo-rhaGGx