NaviServer - programmable web server
4.99  5.0

[ Main Table Of Contents | Table Of Contents | Keyword Index ]

ns_mkdtemp(n) 5.0.0a naviserver "NaviServer Built-in Commands"

Name

ns_mkdtemp - Make a unique temporary directory

Table Of Contents

Synopsis

Description

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.

COMMANDS

ns_mkdtemp ?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

Don't forget to delete the directory when not needed anymore

EXAMPLES

 % ns_mkdtemp /tmp/foo-XXXXXX
 /tmp/foo-rhaGGx

See Also

ns_mktemp

Keywords

directory, global built-in, tmp