Sets the modification date/time of the file specified by the filePath.
TrFile_SetTimestampModified ( switches ; filePath ; timestamp )
|switches||reserved for future use, leave empty or set to "-Unused"|
|filePath||the path to the file|
|timestamp||new modification date/time of the file|
Data type returned
If successful it returns 0.
If unsuccessful it returns an error code starting with $$ and the error code. Returned error codes can be:
|$$-43||The file was not found|
|$$-4241||The date/time is too big|
|$$-4245||The date/time is too small|
Troi File Plug-in 3.0.4
FileMaker Pro 16 to 19
– macOS limits (using filesystem HFS+): on macOS the minimum representable date is January 1st, 1904 GMT. The maximum representable date is February 6, 2040 at 06:28:15 GMT.
– Windows limits: the minimum representable date is January 1st, 1980. The maximum date is December 31, 2107.
– The timestamps are in local time.
– On macOS it may take some time (about 5 secs) before the change is visible in the Finder. On Windows you need to refresh a Window before you see the change.
Set Field [ result ; TrFile_SetTimestampModified ( "-Unused" ; "Mac HD:data:test.txt" ; Timestamp ( Date ( 6 ; 30 ; 2015 ) ; Time ( 10 ; 59 ; 59 ) ) ) ]
This will set the modification date/time to June 30th, 2015 at 10:59:59.
We assume that in your FileMaker file the following fields are defined:
gFileSpec Global, text gTimestampModified Global, timestamp gErrorCode Global, text
gFileSpec should contain the path to an existing file, for example “D:\Out.txt” (Windows) or “Mac HD:Out.txt” (Mac). gTimestampModified should contain a valid date/time. In a script add the following script step:
Set Field [ gErrorCode ; TrFile_SetTimestampModified ( "-Unused" ; this::gTheFile ; this::gTimestampModified ) ]
This will set the file’s modification date/time to the value in the timestamp field.
Used in example file
Related script step
|Set Timestamp Modified|
Troi File Plug-in online help (overview)