Page 1 of 1

Rule to move file based on filename date

PostPosted: Tue Dec 23, 2014 4:43 pm
by irkylol
Hello all,

I currently have a folder that contains certificates of insurance for sub-contractors, the filenames are formatted "Vendor Certificate of Insurance - YYYY-MM.pdf" where YYYY-MM is the policy start date. What I am hoping Hazel can do is process this folder monthly and compare the year and month from the filename to the current year and month, subtract a year from the current date or add a year to the filename date and if the filename date is less than the current date move the file to a folder named Expired. I know Hazel can do this based on date created and modified, but can't for the life of me figure out how to compare a date match to the current.

Re: Rule to move file based on filename date

PostPosted: Tue Dec 23, 2014 5:12 pm
by Mr_Noodle
You'll probably have to use a script for that since you need to do some arithmetic on the date in the condition and not just in the action for output purposes. AppleScripts/JavaScripts in conditions can now export attributes so you should be able to do it using that mechanism.