TrFile_IsFree (function reference)

By May 22, 2019May 20th, 2020Online Help, Troi File Plug-in
Troi File Plug-in for FileMaker Pro


Returns true if this file is not in exclusive use by a different application and is not locked.

SyntaxFunction badge

TrFile_IsFree ( switches ; filePath )


switchesnot used, reserved for future use. Leave blank or put "-Unused"
filePaththe path to the file for which you want to know if it is free

Returned Result

Data type returned



The returned result is a boolean: the function returns 1 if the file is free.
The returned result is 0 if the file is in exclusive use by a different application or is locked.

Note that an error code might be returned instead. An error always starts with 2 dollars, followed by the error code. Returned error codes can be:

$$-43fnfErrFile not found, check if the path is valid

Other errors may be returned.

Originated in

Troi File Plug-in 11.0


FileMaker Pro 15 to 19


Note that some applications do not need to claim a file for exclusive use and will only read the file into their memory (and later write a modified version over the original file). If this is the case the TrFile_IsFree function will always return 1 (is free).


Set Field [ isFree ; TrFile_IsFree ( "-Unused" ;  "C:\Test.xls" ) ]

This will return 0 if Excel has opened this file.

Example 2

We assume that in your FileMaker file the following field is defined:

gFilePath		Global, text

gFilePath should contain the path to the file of which you want to test if it is free, for example “D:\Data\NewReport.doc” (Windows) or “Mac HD:Data:NewReport.doc” (macOS).

In a script add the following script steps:

Set Variable [ $FilePath ; gFilePath ]
If [ TrFile_IsFree ( "-Unused" ;  $FilePath ) ]
   # ... do your stuff here, for example import the file into your database.
   # ... do your error handling here...
End if

Related functionsFunction badge


Related topics

Troi File Plug-in online help (overview)

Online Help Page for Troi File Plug-in for 15 to 19 –> TrFile_IsFree (filep4322) 2020-0520 17:56:33