Relevance using last modified date of file

(imported topic written by donald__small91)

I am trying to create a task that will do some maintenance type tasks that I want to run every 90 days. I know on the Execution tab there is an option to reapply an action at a set interval, but it only goes up to 30 days. So as an alternative I thought I could include relevance to look at the age of a specific file. The first time the task runs it will create the file %windir%\temp\purge.log. The relevance should look for the file and if it does not exist, the task will run. If it does exist, it will look at the last modified date and if it is older than 90 days it should run.

Here is what I have so far

name of operating system = “Win2000” OR name of operating system = “WinXP” OR (name of it = “WinVista” and product type of it = nt workstation product type) of operating system AND (exists file “%25windir%25\temp\purge.log” whose (modification time of it < time (current date as string & " 12:00:00 " & local time zone as string)))

This is the part I need help with:

(modification time of it < time (current date as string & " 12:00:00 " & local time zone as string)))

Any help is always appreciated!!!

(imported comment written by NoahSalzman)

How about something like:

Q: now - modification time of file “c:\foo.txt” > 90*day

A: True

1 Like

(imported comment written by gjeremia91)

You have several options here, but I would draw caution against checking the modificaiton time of a file. Accessing the file system is not always the swiftest operation, and if someone holds a lock against that file there may be some difficulty in obtaining access to it. In most cases it will certainly work, but why not adjust your task slightly so that it can create a setting of that computer:

setting “TASK_LAST_RUN” = “{now}” on “{now}” for client

You can now control when it runs using either the execution tab (the

color=#ff0000

RUN ONLY WHEN[/color] option) OR by just including a check for the setting in your relevance for the task itself !!!

()
AND
(
not (exists setting “TASK_LAST_RUN” whose (exists value whose ((now - it as time)<90*day) of it) of client)
)

This way, if the setting doesn’t exist, it can run right away. When it runs, it creates the setting with the current time on that computer. The fixlet will then no longer be relevant because of that last line we just added. 90 days from now, it will become relevant again !