KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

File Availability older than: create or modification date

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting
View previous topic :: View next topic  
Author Message
AndreT78



Joined: 05 Feb 2020
Posts: 11

PostPosted: Fri Feb 12, 2021 3:51 am    Post subject: File Availability older than: create or modification date Reply with quote

Hi,

File Availibility test: create or modification date

where can i choose which date would be tested ?

Thanks
BR Andre
Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12412
Location: USA

PostPosted: Fri Feb 12, 2021 5:20 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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

KS-Soft Forum Index