directory create temp

Prev Next

Function Names

directory create temp

Library

Utility Library

Description

This function will create a dedicated temporary directory, located as a subdirectory where all othe other temp files are located in your system. Under Windows, the new directory is created in C:\Users\Zur Bonsen Georg\AppData\Local\Temp\b4p\B4P_XXXXXX\ where XXXXXX stands for six random capital letters. Under Linux and MacOS, the new directory is created in /tmp/b4p/B4P_XXXXXX/.

Advice: It is recommended to remove that directory including all contents when you are done using it. Do not count on referring to that directory in a later B4P session and do not use it to store your valuable data for later use. The temp directory is likely cleaned up in regular time intervals.

Call as: function

Restrictions

Under normal conditions, the 'Utility Library' is loaded automatically, so no 'include(...)' call is needed.

Parameter count

0

Return value

TypeDescription
string Path name

This is the full path name to the directory name just created. A directory separator symbol (slash or backslash) has already been added at the end.

Examples

       dir[] = directory create temp();
       echo("Created temp directory '", dir[], "'.");

       // Do something
       table initialize ( little table, { Name, Andy, Beata, Charly, Daniela } );
       table save( little table, dir[] + "Little Table.csv"  );

       // pause; // Remove comment symbols so you can look where the file has been saved.

       directory delete recursive( dir[] ); // Clean up: Remove the temp directory

Output

Created temp directory 'C:\Users\zur-b\AppData\Local\TEMP\b4p\B4P_4CQ5XY\'.
Try it yourself: Open LIB_Function_directory_create_temp.b4p in B4P_Examples.zip. Decompress before use.

See also

directory create
directory delete recursive