Returns the name of a file (or folder) in the filePath, including the extension
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|
Data type returned
the name of the file (or folder) in the filePath
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”.
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