Returns the type of an item, for example if it is a folder or a file.
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)".|
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|
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.
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