Hello, I need some help creating some code that will help prep a GDB for the importation of new data. I have two file geodatabases set up (staging and master), and I need to delete files from the master GDB before uploading new versions from the staging GDB. For example:
Master GDB:
Staging GDB:
arcpy.env.workspace = staging_gdb
staging_fc = arcpy.ListFeatureClasses()
arcpy.AddMessage("adding " + str(staging_fc) + " feature classes to master data")
for fc in staging_fc:
arcpy.conversion.FeatureClassToGeodatabase(fc, master_gdb)
arcpy.AddMessage("copied " + str(fc) + " to master gdb")
Using the code I have now, when the 'bridge' and 'building' staging feature classes get added to the master, they have a '_1' added to the suffix since there are already existing feature classes under the same name. Is there a way to delete feature classes in the master GDB based off the list I create with arcpy.ListFeatureClasses()? I don't believe I can use arcpy.env.overwriteOutput, since the workspace has to be set to the staging GDB in order for the list to be captured.