SysTempFileName

>>-SysTempFileName(template-+---------+-)----------------------><
                            +-,filter-+

Returns a unique name for a file or directory that does not currently exist. If an error occurs or SysTempFileName cannot create a unique name from the template, it returns a null string (""). SysTempFileName is useful when a program requires a temporary file.

Parameters:

template

The location and base form of the temporary file or directory name. The template is a valid file or directory specification with up to five filter characters.

filter

The filter character used in template. SysTempFileName replaces each filter character in template with a numeric value. The resulting string represents a file or directory that does not exist. The default filter character is ?.

Examples:

/* Code */
say SysTempFileName("C:\TEMP\MYEXEC.???")
say SysTempFileName("C:\TEMP\??MYEXEC.???")
say SysTempFileName("C:\MYEXEC@.@@@", "@")

/* Output */
C:\TEMP\MYEXEC.251
C:\TEMP\10MYEXEC.392
C:\MYEXEC6.019

SysTempFileName generates the filter character replacements with a random number algorithm. If the resulting file or directory already exists, SysTempFileName increments the replacement value until all possibilities have been exhausted.

Note on Unix/Linux behaviour: On Unix/Linux the returned path/filename will be longer than the original input template. Additional characters are appended to the end of the filename and a path may be prepended to the beginning of the returned string.