Set Timestamp Modified (script step reference)

By January 1, 2021January 26th, 2021Online Help, Troi File Plug-in
Troi File Plug-in > Script steps reference > Set Timestamp Modified
Troi File Plug-in for FileMaker Pro

Set Timestamp Modified

Sets the modification date/time of the file specified by the filePath.

SyntaxScript step badge

Set Timestamp Modified [ Select ; Result (error) ; FilePath ; Timestamp ]

Options

Select entire contents replaces the entire contents of a field with the result. If not checked the result ireplaces the currently selected portion of the field
Result (error) an error code
FilePath the path to the file
Timestamp new modification date/time of the file

Returned Result

Data type returned

Error code

Result

If successful it returns 0. If unsuccessful it returns an error code starting with $$ and the error code. Returned error codes can be:

0 no error the creation date/time was set
$$-43 fnfErr the file was not found
$$-4241 the date/time is too big
$$-4245 the date/time is too small

Originated in

Troi File Plug-in 9.0

Compatibility

FileMaker Pro 16 to 19

Considerations

– 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.

Example

Set Timestamp Modified [ Select ; $ErrorCode ;  "Mac HD:data:test.txt" ; 
			Timestamp ( Date ( 5 ; 09 ; 2017 ) ; Time ( 08 ; 59 ; 59 ) ) ]

This will set the modification date/time to May 9, 2017 at 08:59:59.

Example 2

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

    gTheFile			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 Timestamp Modified [ Select ; gErrorCode ; gTheFile ; gTimestampModified ]

This will set the file’s modification date/time to the value in the timestamp field.

Related script stepScript step badge

Set Timestamp Created

Related functionFunction badge

TrFile_SetTimestampModified

Related topics

Troi File Plug-in online help (overview)


Online Help Page for Troi File Plug-in for 16 to 19 –> Set Timestamp Modified (filep7286) 2021-0125 20:51:01