+2  A: 

If your server is running linux, a cron job is the best option. Simply write a script that checks the conditions you mention (using e.g. stat and some other tools) and deletes the file if they apply, and set crond to run it every 24 hours. Here's a short introduction to cron.

On Windows, you'd do something similar with a script and a scheduled task.

You