check if file exists before formatting