Check if a file exists and rename another file if the file exists