Hitachi

JP1 Version 11 JP1/Script Description and Reference (For Windows Systems)


8.5.18 SetFileTime (set file date and time)

Purpose

Sets the date and time of a file.

In JP1/Script 07-50 or later, the command supports large files.

Syntax
SetFileTime (PathName, [Date], [Time] [, Type])
Arguments
PathName

Write the full path of the file as a character string or as a variable that stores this value.

Date

Write the date to set in yyyy/mm/dd format as a character string or as a variable that stores this value. Numbers specified in the range 0 to 69 in yyyy are read as 2000 to 2069.

Time

Write the time to set in hh:mm:ss format as a character string or as a variable that stores this value.

Type

Specify the date type as either of the following values:

Value

Meaning

Create

Date created

Update

Date modified

This value is optional. If you omit this value, Update is assumed.

Description

The SetFileTime command sets the date and time of the specified file. The command returns True on successful execution, or False if an error occurs.

If you specify a file in the FAT system, you can only specify dates in the range 1980/1/1 to 2107/12/31.

Note

Take care when specifying a file in the folder set in the environment variable ProgramFiles (normally the Program Files folder on the system drive) or WinDir (normally the Windows folder on the system drive). For details, see 1.8.2 Command behavior.

Example
Dim file1
file1 = _SCF_+"User.txt"
If IsFileAttr (file1, ATTR_ARCHIVE) Then
  SetFileAttr (file1, ATTR_ARCHIVE, ATTR_OFF)
  SetFileTime (file1, Date(), Time(), Update)
End If
JP1/Script version

Supported from JP1/Script 05-10.