Rename (Data Management)

Summary

Changes the name of a dataset. This includes a variety of data types, including feature dataset, raster, table, and shapefile.

Usage

  • The output name must be unique. If it is not, an error message is reported, even if the geoprocessing Allow geoprocessing tools to overwrite existing datasets setting is enabled.

  • The tool also renames the alias of the data.

  • The tool does not rename layers, since a layer is a reference to a dataset.

  • The tool does not rename fields in the dataset. For example, if you have a field named ROADS_ID in a feature class named Roads, renaming the Roads feature class to Streets does not rename the ROADS_ID field to STREETS_ID.

  • The tool does not work with data stored in a DB2 database due to database constraints.

Parameters

LabelExplanationData Type
Input Data Element

The input data to be renamed.

Data Element
Output Data Element

The name of the output data.

Data Element
Data Type

The type of data to be renamed.

This parameter is only necessary in the event of a name conflict between two different data types. For example, a geodatabase can contain a relationship class with an identical name to a feature class. If that is the case, specify the relevant keyword.

  • FeatureClass—In the event of duplicate names, the feature class will be used.
  • FeatureDataset—In the event of duplicate names, the feature dataset will be used.
  • MosaicDataset—In the event of duplicate names, the mosaic dataset will be used.
  • ParcelFabric—In the event of duplicate names, the parcel fabric will be used.
  • RelationshipClass—In the event of duplicate names, the relationship class will be used.
  • Topology—In the event of duplicate names, the topology will be used.
String

arcpy.management.Rename(in_data, out_data, data_type)
NameExplanationData Type
in_data

The input data to be renamed.

Data Element
out_data

The name of the output data.

Data Element
data_type

The type of data to be renamed.

This parameter is only necessary in the event of a name conflict between two different data types. For example, a geodatabase can contain a relationship class with an identical name to a feature class. If that is the case, specify the relevant keyword.

  • FeatureClass—In the event of duplicate names, the feature class will be used.
  • FeatureDataset—In the event of duplicate names, the feature dataset will be used.
  • MosaicDataset—In the event of duplicate names, the mosaic dataset will be used.
  • ParcelFabric—In the event of duplicate names, the parcel fabric will be used.
  • RelationshipClass—In the event of duplicate names, the relationship class will be used.
  • Topology—In the event of duplicate names, the topology will be used.
String

Code sample

Rename example 1 (Python window)

The following Python window script demonstrates how to use the Rename function in immediate mode.

import arcpy
arcpy.env.workspace = "C:/data"
arcpy.management.Rename("customers.dbf", "customers_2010.dbf")
Rename example 2 (stand-alone script)

The following Python script demonstrates how to use the Rename function in a stand-alone script.

# Description: Rename a file geodatabase feature class

# Import system modules
import arcpy

# Set workspace
arcpy.env.workspace = "C:/workspace/test.gdb"

# Set local variables
in_data =  "test"
out_data = "testFC"
data_type = "FeatureClass"

# Run Rename
arcpy.management.Rename(in_data, out_data, data_type)

Related topics