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.
<SPAN class="keyword token">import</SPAN> arcpy
<SPAN class="keyword token">from</SPAN> arcpy <SPAN class="keyword token">import</SPAN> env
<SPAN class="keyword token">import</SPAN> os
ws <SPAN class="operator token">=</SPAN> env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'path\to\34512.shp'</SPAN>
out_ws <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'path\to\gissql(2).sde'</SPAN>
fcList <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFeatureClasses<SPAN class="punctuation token">(</SPAN>ws<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">for</SPAN> shapefile <SPAN class="keyword token">in</SPAN> fcList<SPAN class="punctuation token">:</SPAN>
out_featureclass <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>out_ws<SPAN class="punctuation token">,</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>splitext<SPAN class="punctuation token">(</SPAN>shapefile<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>CopyFeatures_management<SPAN class="punctuation token">(</SPAN>shapefile<SPAN class="punctuation token">,</SPAN> out_featureclass<SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>