I have a shapefile which contains some features and I need to copy these features and paste them into an EXISTING feature class using ArcPy. I have tried the (arcpy.CopyFeatures_management(..)
) but it seems it is used only to copy data from a shapefile to a NEW feature class.
import arcpy
input_ShapeFile ="C:\Users\Moh\Desktop\file.shp"
output_FeatureClass ="C:\Users\Moh\Desktop\Data.mdb\fc"
arcpy.CopyFeatures_management(input_ShapeFile, output_FeatureClass)
...ERROR 000725: Output Feature Class: Dataset "C:\Users\Moh\Desktop\Data.mdb\fc"
already exists. Failed to execute (CopyFeatures).
I am using ArcMap 10.5.
1 Answer 1
I think that both your paths need to be turned into raw strings:
input_ShapeFile = r"C:\Users\Moh\Desktop\file.shp"
output_FeatureClass = r"C:\Users\Moh\Desktop\Data.mdb\fc"
and, as commented by @BERA, try using Append (instead of Copy Features) which:
Appends multiple input datasets into an existing target dataset. Input datasets can be feature classes, tables, shapefiles, rasters, annotation or dimensions feature classes.