AnsweredAssumed Answered

Copy a list of feature classes from Enterprise to Geodatabase

Question asked by ahmadabusaleh on Jul 19, 2017
Latest reply on Jul 19, 2017 by JQuinn-esristaff

Hi

I am trying to write a code that uses “arcpy.CopyFeatures_management” to copy all feature classes inside an Enterprise geodatabase to a Geodatabase.

The issue here happens when using FOR loop to copy the whole list of F.C’s to the geodatabase, I am trying to assign the same name for the features. But it seems that there is something that I am missing.

I tried different statements for “out_feature_class” with no luck, sometimes the code fails to run or it copies a single F.C only.

 

import arcpy ,sys
adminconn=r'C:\1\b2.sde'
gdbFile=r'c:\1\x.gdb'

arcpy.env.workspace=adminconn
arcpy.env.overwriteOutput=True


SDEfcList=arcpy.ListFeatureClasses()
arcpy.env.workspace=gdbFile
for dataitem in SDEfcList:
    fcdesc = arcpy.Describe(dataitem)
    arcpy.CopyFeatures_management(dataitem,gdbFile+fcdesc.name)

 

 

Thanks

Outcomes