Age of newest file in directory
In custom.conf:
[Age of newest file in C:\Path] command=cscript /nologo C:\newestfileage.vbs C:\Path\ type=integer result_pattern=([[:digit:]]+) unit=h timeout=5
In newestfileage.vbs:
' This script processes the list of files in the directory given in
' its argument, and returns the age of the youngest file in hours
Set StdOut = WScript.StdOut
dim fso, f, fe
Set fso = CreateObject("Scripting.FileSystemObject")
set f = fso.getFolder(WScript.Arguments(0))
dim youngest
youngest = 1000000
For Each file in f.Files
dim age
age = DateDiff("h", file.DateLastModified, Now)
if age < youngest then youngest = age
next
StdOut.WriteLine youngest
WScript.Quit(0)