Age of a certain file
In custom.conf:
[Age of .DAT file] command=cscript /nologo C:\filetime.vbs C:\Path\To\.DAT-file type=integer result_pattern=([[:digit:]]+) unit=h timeout=5
In filetime.vbs:
Dim Args, FS, File, FileName
Set Args = WScript.Arguments
Set FS = CreateObject("Scripting.FileSystemObject")
if WScript.Arguments.Count <> 1 then
WScript.Echo "You must specify a filename"
WScript.Quit(1)
end if
FileName = WScript.Arguments(0)
if not FS.FileExists(FileName) then
WScript.Echo "The specified file does not exist"
WScript.Quit(1)
end if
Set File = FS.GetFile(FileName)
' There are several options for what to output. The "h" parameter is hours,
' and can be changed to e.g. "D" for days.
'WScript.Echo DateDiff("h", File.DateCreated, Now)
'WScript.Echo DateDiff("h", File.DateLastAccessed, Now)
'WScript.Echo DateDiff("D", File.DateLastModified, Now)
WScript.Echo DateDiff("h", File.DateLastModified, Now)