Copy (Data Management)

Summary

Copies input data and pastes the output to the same or another location regardless of size. The data type of the input and output data element is identical.

Usage

Syntax

Copy_management (in_data, out_data, {data_type})
ParameterExplanationData Type
in_data

The data to be copied to the same or another location.

Data Element
out_data

The location and name of the output data. The file name extension of the output data must match the extension of the input data. For example, if you are copying a file geodatabase, your output data element must have .gdb as a suffix.

Data Element
data_type
(Optional)

The type of the data to be copied. The only time you need to provide a value is when a geodatabase contains a feature dataset and a feature class with the same name. In this case, you need to select the data type (feature dataset or feature class) of the item you want to copy.

String

Code Sample

Copy example 1 (Python window)

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

import arcpy
from arcpy import env

env.workspace = "C:/data"
arcpy.Copy_management("majorrds.shp", "C:/output/majorrdsCopy.shp")
Copy example 2 (stand-alone Python script)

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

# Name: Copy_Example2.py
# Description: Copy major roads dataset to preserve the original data

# Import system modules
import arcpy
from arcpy import env

# Set workspace
env.workspace = "C:/data"

# Set local variables
in_data =  "majorrds.shp"
out_data = "C:/output/majorrdsCopy.shp"
data_type = ""

# Execute Copy
arcpy.Copy_management(in_data, out_data, data_type)

Environments

Related Topics

Licensing Information

ArcView: Yes
ArcEditor: Yes
ArcInfo: Yes

8/13/2014