I have a script that runs through a database and deletes all the empty feature classes. Often I deal with databases that have hundreds of empty feature classes and it can take quite a while to run the tool that deletes the empty FCs. I have an idea to delete the entire feature data set that houses the empty FCs instead (thinking it would be faster). Any suggestions on how to do this?
Essentially, if a feature data set has a FC in it that has data it would still have to individually delete the empty FCs, but if the entire feature data set only houses empty FCs, I would like to just delete the data set itself. It may actually not be faster (just an idea). Here is my script as it stands.
import arcpy arcpy.env.workspace = arcpy.GetParameterAsText(0) datasetList = arcpy.ListDatasets('*', 'Feature') for dataset in datasetList: fcList = arcpy.ListFeatureClasses('', '', dataset) for fc in fcList: results = arcpy.GetCount_management(fc) count = int(results.getOutput(0)) if count == 0: arcpy.Delete_management(fc) arcpy.AddMessage('Deleting ' + fc) else: pass