Skip to main content

TrFile_GetTimestampLastAccessed (function reference)

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


Returns the date and time a file was accessed (opened) for the last time.

SyntaxFunction badge

TrFile_GetTimestampLastAccessed ( switches ; filePath )


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

Returned Result

Data type returned



The returned result is the date and time the file was last accessed. The result is formatted like this:
YYYY-MM-DD HH:MM:SS. Store the result in a timestamp field.

An error code might also be returned. An error always starts with 2 dollars, followed by the error code. Returned error codes can be:

$$-43 fnfErr File not found, check if the path is valid

Other errors may be returned.

Originated in

Troi File Plug-in 3.5


FileMaker Pro 16 to FileMaker Pro 2023


On Windows some file systems (FAT) only store the actual date of the last access. The time in this case the time part will be 00:00:00.


Set Field [ lastAccessedTimestamp ; TrFile_GetTimestampLastAccessed ( "-Unused" ;  "C:\Test.txt" ) ]

This may return the result: “2006-12-22 15:55:17”.

Example 2

We assume that in your FileMaker file the following fields are defined:

   lastAccessedDateTime	timestamp
   gFilePath		Global, text

gFilePath should contain the path to the file for example “D:\Logs\L01.TXT” (Windows) or “Mac HD:Logs:Log 1” (Mac). In a script add the following script step:

Set Field [ lastAccessedDateTime ; TrFile_GetTimestampLastAccessed ( "-Unused" ;  gFilePath ) ]

This will store the timestamp the file, specified by gFilePath, was opened for the last time in the field lastAccessedDateTime.

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_GetTimestampLastAccessed (filep4293) 2023-0601 15:41:40