8.5.19 GetFileTime (get file date and time)
- Purpose
-
Gets the date and time of a file.
In JP1/Script 07-50 or later, the command supports large files.
- Syntax
GetFileTime (PathName, [DateBuff], [TimeBuff] [, Type])
- Arguments
-
- PathName
-
Write the full path of the file as a character string or as a variable that stores this value.
- DateBuff
-
Specify a variable for storing the date. The date is returned in yyyy/mm/dd format. Omit this argument if not required.
- TimeBuff
-
Specify a variable for storing the time. The time is returned in hh:mm:ss format. Omit this argument if not required.
- Type
-
Specify the date type to acquire 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 GetFileTime command gets the date and time of the specified file. The command returns True on successful execution, or False if an error occurs.
- 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.3 Effect of the executing user on command behavior.
- Example
Dim file1, file2, dateBuff, timeBuff file1 = _SCF_+"User.txt" file2 = _SCF_+"UserBkup.txt" If GetFileTime (file1, dateBuff, timeBuff, Create) = True Then SetFileTime (file2, dateBuff, timeBuff, Create) End
- JP1/Script version
-
Supported from JP1/Script 05-10.