Add check file exists to rename function