Storing Files in Temp Folder -

A bit off focus of KM creation...... apologies.....
Is is ok to store files in the temp folder? /tmp
I frequently make small text files or the like that I then store in Filemaker Pro.
They need to be saved first though, and I though I would save them to the temp folder, not caring if they get deleted because they are then stored in Filemaker.
Any opinion would be appreciated.
Thanx

As far as I know the contents of the /tmp folder is deleted on reboot. So, it should be OK.

However, personally I would prefer to use the “official” temporary directory via the $TMPDIR variable.

I use the /tmp folder often, but only in the context of a single execution of a macro or script.
IOW, in the same script, I create a file/folder in /tmp, and then do something with that file, and I'm done with the file.

I never store a file in '/tmp that I will need beyond the immediate future,

I've never had any issues with this approach.

Make sense?

Any specific reason to not use the $TMPDIR ?

Nope. I just like the conciseness and ease of use of /tmp.
For example, if I want to check what's in the folder all I have to do in the Finder is ⌘⇧G and type /tmp

OTOH, I see no reason not to use /tmp.

Yes, pragmatically it should be the same. A difference might be that the $TMPDIR is cleaned upon login (to verify), whereas the /tmp folder is cleaned upon reboot only.

The main advantage I see in using the $TMPDIR variable is that it contributes to less hard-coding. YMMV.

I worry a little about using a hardcoded path but having multiple instances of code referring to the path at the same time, causing a conflict. Can anyone tell me if there's a way to include a string unique to my instance of code that will prevent such naming conflicts?

Use a random number in the path. Specifically the RandomUUID token would be appropriate, and path friendly.

Alrighty. I also found %ExecutingMacroUUID% which would allow me to do the same thing within a single macro (which would save me the need to store a random string in a variable). But I couldn't find something like %ExecutingInstanceUUID% which would be constant within the same instance.

Peter, I just use this convenient ICU token:
%ICUDateTime%yyyy-MM-dd-HHmmssA%

Example:
2019-08-09-11541242852220

Time to the millisec should guarantee a unique file name in almost all cases, plus it tells me when the file was created.