Kaseya Community

See if a file is older than 24 hours

This question is answered

Hello Comunnity,

Forgive me please, i'm new to Kaseya as we just got the software.

 

I have writen an agent procedure that gets a specific file's date and parses the date & content of this file in an email message.

The next step is that I want to trigger an action that compares the file's date to the current date.

The trigger (if step) should be activated when the file's date is older that 24 hours compared to the current date.

I have not yet found a way to do this.

 

I've read that there should be a general variable called "CURRENTDATE", but have not found a way to compare that variable to the file date.

 

Anyone know of a way to do this?

 

Verified Answer
  • Sans XP without forfiles.exe installed:

    New Step: Execute shell command - Get results to variable: As system:  forfiles /p "c:\some\directory"  -m "somefile.txt" -d -1 -c "cmd /c echo OLD"

    New IF: Check Variable: #global:cmdresults# contains OLD

All Replies
  • Sans XP without forfiles.exe installed:

    New Step: Execute shell command - Get results to variable: As system:  forfiles /p "c:\some\directory"  -m "somefile.txt" -d -1 -c "cmd /c echo OLD"

    New IF: Check Variable: #global:cmdresults# contains OLD

  • Thank you Dan, that did the trick.

    (Learning fast)