|
View previous topic :: View next topic |
Author |
Message |
AndreT78
Joined: 05 Feb 2020 Posts: 14
|
Posted: Fri Feb 12, 2021 3:51 am Post subject: File Availability older than: create or modification date |
|
|
Hi,
File Availibility test: create or modification date
where can i choose which date would be tested ?
Thanks
BR Andre |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12817 Location: USA
|
Posted: Fri Feb 12, 2021 5:20 am Post subject: |
|
|
This test does not check creation time, just last modification time (modification time = creation time when file was not edited).
If you need to check creation time, you may use Shell Script test and some simple script like this:
Code: | Option Explicit
const statusUnknown = "scriptRes:Unknown:"
const statusOk = "scriptRes:Ok:"
const statusBad = "scriptRes:Bad:"
Dim fso, objFSO, objFile, strFile, objArgs, diff
Set objArgs = WScript.Arguments
if objArgs.Count<1 then
WScript.StdOut.Write statusUnknown & "required parameters: <path to file> [<threshold in hours>]"
Wscript.Quit
End if
strFile = objArgs(0)
Set objFSO = CREATEOBJECT("Scripting.FileSystemObject")
if objFSO.FileExists(strFile) then
SET objFile = objFSO.GetFile(strFile)
else
WScript.StdOut.Write statusUnknown & "File does not exists: " & strFile
Wscript.Quit
end If
if objArgs.Count=1 then
WScript.StdOut.Write statusOk & objFile.DateCreated
else
diff = DateDiff("h", objFile.DateCreated, Now())
if diff > int(objArgs(1)) then
WScript.StdOut.Write statusBad & diff
else
WScript.StdOut.Write statusOk & diff
end if
end if |
Regards
Alex |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|