CopyDatasets will not overwrite some datasets

المشرف العام

Administrator
طاقم الإدارة
I used a script from esri found here http://support.esri.com/en/knowledgebase/techarticles/detail/40831 to import all the feature datasets and feature classes from one file database to another. In the end it will be for one sde database to another but for testing purposes im using a file geodatabase to file geodatabase. I can do the initial copy from one data base to the other ( the other being empty to start with), then when I go to overwrite the database a second time ( the end script will run nightly and copy over features every night) it will shoot back at an error:

Traceback (most recent call last): File "H:/Scripting/Copying from one database to another.py", line 82, in CopyDatasets(start_db,end_db,num) File "H:/Scripting/Copying from one database to another.py", line 20, in CopyDatasets arcpy.Copy_management(dataset, wk2 + os.sep + new_data) File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\management.py", line 4047, in Copy raise e ExecuteError: ERROR 000260: Failed to copy C:\Users\USER\Desktop\Testing\Local Government Model\LocalGovernment.gdb\LandUseOperations into C:\Users\USER\Desktop\Testing\Local Government Model\Test_LocalGovernment.gdb\LandUseOperations Failed to execute (Copy). It is in the following code where it is giving me an issue. I have already set

arcpy.env.overwriteOutput = True def CopyDatasets(start_db,end_db,num): print "Copying Datasets..." #Set workspaces arcpy.env.workspace = start_db wk2 = end_db datasetList = arcpy.ListDatasets() print datasetList #for feature classes within datasets for dataset in datasetList: print "Reading: {0}".format(dataset) name = arcpy.Describe(dataset) new_data=name.name[num:] #if arcpy.Exists(wk2 + os.sep + new_data)==False: arcpy.Copy_management(dataset, wk2 + os.sep + new_data) print "Completed copy on {0}".format(new_data) #else: # print "Dataset {0} already exists in the end_db so skipping".format(new_data) #Clear memory del dataset print "Datasets Copied..." I think it has to do with how it is also importing in the tables alongside the data, instead if just the feature dataset alone.



أكثر...
 
أعلى