Detect whether file exists before deleting file.