TrFile_Exists | 
Check for the existence of a file or folder.
Syntax
TrFile_Exists ( switches ; filePath )
Parameters
| switches | not used, reserved for future use. Leave blank or put "-Unused" | 
| filePath | the path to the file for which you want to know if it exists | 
Returned Result
Data type returned
Number
Result
The returned result is a boolean: the function returns 1 if the file or folder exists. If it does not exist or if an error occurs it will return 0.
Originated in
Troi File Plug-in 3.1
Compatibility
FileMaker Pro 18 to FileMaker Pro 22 (2025)
Considerations
If the function returns 0 you should decide if it is necessary to check for errors, for example if a file is on a disk that is not mounted.
Example
Set Field [ doesExists ; TrFile_Exists ( "-Unused" ;  "C:\Test.txt" ) ]
This will return 1 if it exists.
Example 2
We assume that in your FileMaker file the following field is defined:
  gFilePath		Global, text
gFilePath should contain the path to a file, for example “D:\Logs\L2000_01.TXT” (Windows) or “Mac HD:Logs:Log 2000_01” (Mac). In a script add the following script steps:
if [ TrFile_Exists ( "-Unused" ;  gFilePath ) ]
   # ... do your stuff here
else
   # ... do your error handling here....
endif
This will make it easy to handle existing files.
Used in example file
Attribute.fmp12
Related functions
| TrFile_GetDateModified | 
| TrFile_GetTimestampCreated | 
| TrFile_IsFree | 
| TrFile_SelectFileDialog | 
Related topics
Troi File Plug-in online help (overview)