Valid on NetWare, Symbian OS, UNIX, Windows and Windows CE
The SetFileTime function sets the timestamps of a file or directory.
This file content function has the format:
SetFileTime(fileName as string, dateAndTime as DateTime, Type as integer) as Boolean
SetFileTime(fileName as string, dateAndTime as DateTime) as Boolean
Specifies the name of the file for which the date and time is to be modified.
Identifies the new date and time to be set.
Value 0; Creation date and time will be modified (default).
Value 1; Last access file date and time will be modified.
Value 2; Last modified file date and time will be modified.
Value 3; Creation, last access, and final write date and time will be modified.
On successful completion, the function returns TRUE; otherwise, it returns FALSE.
Example: SetFileTime function
Rem modify write time
Dim newTime as DateTime
newTime.year = 1999
newTime.month = 12
newTime.day = 31
newTime.hour = 23
newTime.minute = 59
newTime.second = 59
If Not(SetFileTime("c:\autoexec.bat",newTime,2)) Then
Print ("SetFileTime failed")
Exit
End If
You can read and compare the version information of any file using DMScript functions. For example, you can read and compare the version of dmscript.exe to verify whether the script is running on the desired version of DMScript.
The GetFileInfo function reads the file information of a given file. You can use the retrieved file information in other functions such as CompareVersions.
This function has the following format:
GetFileInfo (option as string, filename as string, result as string) as boolean
Example: GetFileInfo
getfileinfo("version","dmscript.exe",version)
Input Parameters
This function has the following input parameters:
Specifies the file information you want to retrieve. You can specify one of the following options:
Retrieves the complete file version string in the format major.minor.patch.build. Example: "12.5.0.1234"
Retrieves the major version number of the file.
Retrieves the minor version number of the file.
Retrieves the patch number of the file.
Retrieves the build number of the file.
Retrieves the file description (Windows only).
Retrieves the file extension.
Retrieves the file name from a path name without the extension.
Specifies a string variable that holds the result returned by the function.
Return Values
If the function is able to retrieve the file information, it returns true.
The CompareVersions function compares two file versions and returns whether they are identical. This function has the following format:
CompareVersions (version1 as string, version2 as string) as integer
Example: CompareVersions
CompareVersions ("12.5.1.4", "12.5.0.3")
Input Parameters
This function has the following input parameters:
Specifies the versions of the file you want to compare. You can specify any number of version identification items in the version string. For example, you can specify the version string using the major.minor.patch.build format or just the major.minor format. The version numbers can be separated by dots, spaces, or commas. If one version string has more identification items than the other version string, the missing items are replaced with zero at the time of comparison. For example, CompareVersions ("12.5.180.123", "12.5") is treated as CompareVersions ("12.5.180.123", "12.5.0.0").
Return Values
The function returns one of the following predefined integer constants:
Indicates that the versions are equal.
Indicates that version 1 is greater than version 2.
Indicates that version 1 is lower than version 2.
Indicates that one or both of the version strings is blank or contains a non-numeric value.
|
Copyright © 2013 CA.
All rights reserved.
|
|