Rename the file according to the format