Finder actions

Just wondering if there’s a script written somewhere that might automate a couple of infinitely repeated actions.

When I drag a file to a folder, I’d like the Finder to check if there’s a file by the same name (which it does by default) but if there IS, and the date stamp is the same or older, I’d like the file I’m moving to automatically go to the trash. (We need to keep the older version: a newer version of the same name would be spurious in our workflow).

I’ve done a tiny amount of scripting but am at a novice level. I might be able to piece this together myself if anyone could point me in the right direction.

If it matters this would need to work on the very old Yosemite Macs at the office. They keep saying they’re going to finally upgrade us, but I have yet to see action on that front.

This post is likely better suited for the ‘AppleScript | Mac OS X’ forum.