Check if file is older than X days

Today I needed a rule in hazel which was able to check if a file was older than X days.

While there are some options in hazel like before this year, I mistrusted them to work in
the correct way and I wanted to do some more applescript.
So I wrote a quick applescript to check if the file modified date is older than X days and than
return a true.


-- Set the age of files that you want to keep
set keepDays to (360)
tell application “Finder”
set modDate to modification date of theFile
if modDate is less than ((current date)) - keepDays * days then
return true
end if
end tell
— File is younger than keepDays
return false