TrFile_GetTypeOfItem (function reference)

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

TrFile_GetTypeOfItem

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

SyntaxFunction badge

TrFile_GetTypeOfItem ( switches ; filePath )

Parameters

switchesmodifies the behavior of the function
filePaththe path to the file or folder for which you want to know the type

Switches

Switches can be empty or you can add this switch:

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

Returned Result

Data type returned

Text

Result

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:

$$-43fnfErrFile or folder not found
$$-50paramErrParameter error

Originated in

Troi File Plug-in 5.0

Compatibility

FileMaker Pro 13 to 17

Considerations

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 Mac OS applications are package folders.

Example

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.

Related functionsFunction badge

TrFile_Exists
TrFile_ListFolder

Related topics

Troi File Plug-in online help (overview)


Online Help Page for Troi File Plug-in for 13 to 17 –> TrFile_GetTypeOfItem (filep4300) 2018-0515 15:45:52