3 Replies Latest reply: Mar 3, 2009 2:22 PM by BenChase
BenChase Level 1 (10 points)
I have a script that I want to use to check the number of days old a file is. 2 things happen, I check to make sure the file is more then 5 days old and then I set the number of days old as a variable.

This is what I have but my problem is that it doesn't work if the file's mod date is in a different month.

How can I get this to work taking into account month and probably year?

property NumDays : 0 --Number of Days to check
property ProofsOutFolder : "my:location"

set dateNow to current date

tell application "Finder"
set theFiles to every file of folder ProofsOutFolder
repeat with aFile in theFiles
set fileModDate to modification date of aFile
if ((day of dateNow) - (day of fileModDate)) ≥ NumDays then
set DaysOut to ((day of dateNow) - (day of fileModDate))