Rule to move file based on filename date

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Rule to move file based on filename date 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.
irkylol
 
Posts: 1
Joined: Tue Dec 23, 2014 4:03 pm

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.
Mr_Noodle
Site Admin
 
Posts: 11866
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support