I want to progammatically move a feature class into a different feature dataset within the same file geodatabase. I'm wondering if there is a way of doing this without including code to rename and delete data.

My current code looks something like this:

for fc in fc_list:
        out_fc = fc+'_1'
        arcpy.FeatureClassToFeatureClass_conversion(fc, archive, out_fc)
        arcpy.Rename_management(out_fc, fc)
  • I'm pretty sure you have the best arcpy solution available. Why not just open catalog, select the feature classes, and drag them into the new feature dataset? – jbalk Nov 27 '18 at 20:08
  • it's in a script that updates one FGDB to match another, and it checks/updates the locations of several hundred feature classes on a weekly basis. i was thinking there would be a faster way than copying/deleting large feature classes. i'd prefer to be able to just switch the feature dataset and eliminate all that work. – CSB Nov 27 '18 at 20:22
  • Well, if you know any .net you could probably do it by scripting the moving of the feature classes through catalog. I don't know of an arcpy move data command and I couldn't find one when I searched. You could try switching over to arcpy.CopyFeatures_management(). I think it's a bit faster than fc to fc conversion – jbalk Nov 27 '18 at 21:23
  • 1
    You could of course put what you are doing in a function, but that will at most save you some typing. Or find a way of only updating the records that have changed. – BERA Nov 28 '18 at 5:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.