I recently upgraded my Mac from Snow Leopard to El Capitan. I had been using a utility called Compost, which automatically deletes anything that has been in the trash more than a configured amount of time (also there are lots of other options, like if the disk is more than n% full). It doesn't seem to be working any more. The preference pane still works (although it's a 32-bit pane so it requires an annoying reload of System Preferences), and I can see the process running in Activity Monitor, but files aren't getting deleted.
Unfortunately, the developer stopped maintaining it several years ago. Anyone know of something similar that works in El Cap?
Best Answer
twtwtw's answer uses an Applescript and a launchd plist file to automatically execute the script at midnight. The files in trash then gets today's date written into the comments section, and if the date matched is older than x days, deleted. TL;DR: File is deleted depending on the date written in the comments section of file.
Tony T1's answer uses only a plist file in the launchd, and it deletes files based on the created date. Tony T1 also adds this:
Sidenote for a fix for Tony T1's answer
Alternative to Compost – MacRumors forum
Apple Communities discussion