Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Folders.SystemTemporary

Queries temporary folder.

Component Version macOS Windows Linux Server iOS SDK
Folders 4.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Folders.SystemTemporary" )

Parameters

none

Result

Returns path or error.

Description

Queries temporary folder.
This is a native path. You can use Path.NativePathToFileMakerPath if you need to use path in a script step.

On Mac Folders.UserTemporary is in the user's home folder while the system wide temporary folder is in /var/folders and can be queried with Folders.SystemTemporary.

Examples

Queries path:

MBS( "Folders.SystemTemporary" )

Write container to temp file and launch:

# get temp folder
Set Variable [$TempFolder; Value:MBS( "Folders.SystemTemporary" )]
# and file name from container
Set Variable [$name; Value:MBS( "Path.LastPathComponent"; test::myContainer )]
# add name to folder path
Set Variable [$TempPath; Value:MBS( "Path.AddPathComponent"; $TempFolder; $name )]
# now write temp file
Set Variable [$r; Value:MBS( "Files.WriteFile"; test::myContainer; $TempPath)]
# and launch file
Set Variable [$r; Value:MBS( "Files.LaunchFile"; $TempPath)]

Download URL to temp file:

Set Variable [$curl; Value:MBS("CURL.New")]
#this is URL to download
Set Variable [$url; Value:"https://www.monkeybreadsoftware.com/filemaker/test.txt"]
#get file name from URL
Set Variable [$name; Value:MBS( "Path.LastPathComponent"; $URL )]
#now make temp file path
Set Variable [$path; Value:MBS( "Path.AddPathComponent"; MBS( "Folders.SystemTemporary" ); $name )]
#set URL to download
Set Variable [$r; Value:MBS("CURL.SetOptionURL"; $curl; "https://www.monkeybreadsoftware.com/filemaker/test.txt")]
#open destination file
Set Variable [$r; Value:MBS("CURL.CreateOutputFile"; $curl; $path)]
#run transfer
Set Field [CURL Test::Result; MBS("CURL.Perform"; $curl)]
#close destination file
Set Variable [$r; Value:MBS("CURL.CloseOutputFile"; $curl)]
#get debug messages
Set Field [CURL Test::debug; MBS("CURL.GetDebugMessages"; $curl)]
Set Variable [$result; Value:MBS("CURL.Release"; $curl)]

Try it on Windows:

MBS("Path.AddPathComponent"; MBS( "Folders.SystemTemporary" ); "test")

Example result: C:\Users\cs\AppData\Local\Temp\test

See also

This function is free to use.

Created 18th August 2014, last changed 17th October 2023


Folders.SystemFonts - Folders.UserDesktop