CreateTempFile

Creates a temporary file in the specified directory with the specified prefix and suffix if passed.

Method Signature

CreateTempFile(directory=[string], prefix=[string], suffix=[string])

Arguments

Argument
Type
Required
Description
Default

directory

string

false

The directory in which to create the temp file, we default to the system temp directory

/var/folders/sh/yq09rnbj48764cvf2k4nhcxh0000gn/T/

prefix

string

false

The prefix string to be used in generating the file's name; may be empty

suffix

string

false

The suffix string to be used in generating the file's name; may be empty, in which case ".tmp" is used

Examples

Create temp file in temp dir

Returns path of file created

Run Example

getTempFile( getTempDirectory(), "testFile" );

Result: /private/var/folders/k6/hm9skhxj2dd_901z2f2mkwt00000gn/T/testFile13427324567646329113.tmp

Additional Examples

Run Example

dump( GetTempFile( getTempDirectory(), "demo" ) );

Last updated

Was this helpful?