AnsweredAssumed Answered

Copy Shapefiles to Enterprise Geodatabase Feature Dataset

Question asked by jpilbeam Champion on Jul 31, 2019
Latest reply on Aug 2, 2019 by LanceCole

Is there a way I can copy shapefiles in a directory to an Enterprise Geodatabase Feature Dataset in a stand-alone script? As a monthly update, the shapefiles would replace/update feature classes with the same names in a feature dataset.

 

I've attempted to copy a shapefile using an SDE connection file with arcpy.CopyFeatures. The script ran but nothing happened.

import arcpy
from arcpy import env
import os

ws = env.workspace = r'path\to\34512.shp'
out_ws = r'path\to\gissql(2).sde'

fcList = arcpy.ListFeatureClasses(ws)

for shapefile in fcList:
    out_featureclass = os.path.join(out_ws, os.path.splitext(shapefile)[0])
    arcpy.CopyFeatures_management(shapefile, out_featureclass)

Outcomes