Age of newest file in directory

' 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)

Our mission

We deliver substantial added value to professional users of enterprise, internet and industrial ICT networks by enabling them to achieve best-practice high availability, stability and security of those networks, and an improved life-cycle management of their IT hardware infrastructures.