Skip to main content

TrFile_GetTypeOfItem (function reference)

Troi File Plug-in > Functions reference > TrFile_GetTypeOfItem
Troi File Plug-in for FileMaker Pro


Returns the type of an item, for example if it is a folder or a file.

SyntaxFunction badge

TrFile_GetTypeOfItem ( switches ; filePath )


switches modifies the behavior of the function
filePath the path to the file or folder for which you want to know the type


Switches can be empty or you can add this switch:

-AddAliasInfo if it is an alias file (or shortcut on Windows) the result will be "file (alias)".

Returned Result

Data type returned



The returned result can be one of:
– file: if the path points to a file
– folder: if the path points to a folder (directory)
– package folder: if the path points to a package folder (Mac OS only)

If the path does not exist or if an error occurs an error code will be returned, starting with $$. Returned error codes can be:

$$-43 fnfErr File or folder not found
$$-50 paramErr Parameter error

Originated in

Troi File Plug-in 5.0


FileMaker Pro 16 to FileMaker Pro 2023


This function provides an easy way to see if a path points to a folder or a file. Please note that in the future other types may be returned.

About package folders: these are folders that behave more like a file. For example all macOS applications are package folders.


TrFile_GetTypeOfItem ( "-Unused" ;  "C:\Test.txt" )

This will return “file” if the file exists (and is a file). If it does not exists $$-43 is returned.

Example 2

Set Variable [ $whatKind ; TrFile_GetTypeOfItem ( "-Unused" ;  "filemac:/Mac HD/Users/Smith/Data Folder ) ]

This will set the variable $whatKind to “folder” if the folder exists (and is a folder). If it does not exists $$-43 is returned.

Used in example file


Related functionsFunction badge


Related topics

Troi File Plug-in online help (overview)

Online Help Page for Troi File Plug-in for 16 to 2023 –> TrFile_GetTypeOfItem (filep4300) 2023-0601 15:42:37