Use unlink_if_exists or @unlink to avoid PHP errors when file doesn't exist
Simplify logic calling grep less times, as done on mail_reports.inc on 2c6efc9