Skip to main content

TrFile_GetFileName (function reference)

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


Returns the name of a file (or folder) in the filePath, including the extension

SyntaxFunction badge

TrFile_GetFileName ( switches ; filePath )


switches not used, reserved for future use. Leave blank or put "-Unused"
filePath the path to the file of which you want the name

Returned Result

Data type returned



the name of the file (or folder) in the filePath

Originated in

Troi File Plug-in 14.0


FileMaker Pro 16 to FileMaker Pro 2023


You can use this function to easily get the (file)name part in a filePath string. The result will include the extension, if present.

You can use FileMaker styled paths (which uses forward slash as separator). On Windows you can also use Windows style paths (which use backslash as separator) and on macOS you can use paths which use colon as separator.

NOTE The plug-in does not test if the path is correct or if the file (or folder) exists.


TrFile_GetFileName ( "" ;  "C:\Test.txt" ) ]

This will return the extension “Test.txt”.

TrFile_GetFileName ( "" ; "MacHD:data.kip:my filename" ) ]

This will return “my filename”.

TrFile_GetFileName ( "" ; "filemac:/MacHD/trident/submar/filename.log" ) ]

This will return “filename.log”.

TrFile_GetFileName ( "" ; "/C:/trident/subdir/directory1/" ) ]

This will return the name of a directory, “directory1”.

Example 2

Set Variable [ $FileName ; 
                         TrFile_GetFileName ( "" ; "filemac:/Mac HD/Users/Smith/Report.fmp12" ) ]

This will set the variable $FileName to “Report.fmp12”.

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_GetFileName (filep4329) 2023-0601 15:31:09