Hi AllI'm writing a arcpy script to copy many feature classes from one workspace (file geo database) to another. It's important for me that the script works between existing feature classes, i.e. Not try to create new feature classes, but appends the copied features as new features to the existing feature classes.If you know Batch-Copy-Paste, this is the same, only without messing up the PLTS_Compilation info.Due to the above requirements it seemed out of the question to use either of:arcpy.CopyFeatures_management()arcpy.FeatureClassToGeodatabase_conversion()arcpy.FeatureClassToFeatureClass_conversion()arcpy.Copy_management()even with the 'overwrite output' turned on, as they all aim at creating a new output feature class.I therefore decided to go row-by-row with a Search-cursor and an Insert-cursor.The two .gdb already exist, and have identical structure (schema) but the output.gdb holds no features in the feature classesThe script looks like this:import os, arcpy
def inventory_data(workspace, datatypes):
for path, path_names, data_names in arcpy.da.Walk(workspace, datatype=datatypes):
for data_name in data_names:
yield os.path.join(path, data_name)
def match_feature_names(FA,lstFB):
FAName = FA[FA.rfind("\\")+1:]
for FB in lstFB:
if FAName in FB:
return FB
return False
#Main
genWSA = inventory_data(r"C:\data\input.gdb", "FeatureClass")
lstWSA = list(genWSA)
genWSB = inventory_data(r"C:\data\output.gdb", "FeatureClass")
lstWSB = list(genWSB)
for FCA in lstWSA:
print "Copying:"+FCA
lst_field_names = [fldX.name for fldX in arcpy.ListFields(FCA)]
curWrite = arcpy.da.InsertCursor(match_feature_names(FCA,lstWSB),lst_field_names)
with arcpy.da.SearchCursor(FCA,"*") as curRead:
for row in curRead:
curWrite.insertRow(row)
del curRead,curWrite
For some reason it only works well for Point feature classes. Any Line or Polygon feature class have the attributes copied correctely, but the 'shape' is empty. Also the length- and area-field holds only 0 (zero) in all output rowsAny suggestion are appreciated.Best regardsMartin