You can first create a new temp file and then delete the old one.