Hi,
I need to configure a test for existence of old file ( more than 2 hours) and non empty. the application that removes and process the files isn't taken empty files, so it is normal that empty files exists.
best regards
Geert
Check for old file with non zero size
You need custom script and Shell Script test method.
Something like
Regards
Alex
Something like
Code: Select all
const statusAlive = "scriptRes:Host is alive:"
const statusDead = "scriptRes:No answer:"
const statusUnknown = "scriptRes:Unknown:"
const statusNotResolved = "scriptRes:Unknown host:"
const statusOk = "scriptRes:Ok:"
const statusBad = "scriptRes:Bad:"
const statusBadContents = "scriptRes:Bad contents:"
Dim fso, f, f1, bad1, difflimit
Set objArgs = WScript.Arguments
if objArgs.Count<1 then
WScript.StdOut.Write statusUnknown & "required parameters: <path to folder> [<threshold in min>]"
Wscript.Quit
End if
difflimit = 120
if objArgs.Count>1 then
difflimit = int(objArgs(1))
End if
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(objArgs(0))
Set fc = f.Files
bad1 = 0
For Each f1 in fc
if f1.size >0 then
diff = DateDiff("n", f1.DateLastModified, Now())
if diff > difflimit then
bad1 = 1
WScript.StdOut.Write statusBad & f1.name
EXIT FOR
end if
end if
Next
if bad1=0 then
WScript.StdOut.Write statusOk
end if
Alex