TrFile_Exists (function reference)

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

TrFile_Exists

Check for the existence of a file or folder.

SyntaxFunction badge

TrFile_Exists ( switches ; filePath )

Parameters

switchesnot used, reserved for future use. Leave blank or put "-Unused"
filePaththe 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 15 to 19

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.

Related functionsFunction badge

TrFile_GetDateModified
TrFile_GetTimestampCreated
TrFile_IsFree
TrFile_SelectFileDialog

Related topics

Troi File Plug-in online help (overview)


Online Help Page for Troi File Plug-in for 15 to 19 –> TrFile_Exists (filep4216) 2020-0520 16:01:36