What's the simplest way to delete all of the contents in a FGDB using arcpy?
Solved! Go to Solution.
I was able to get the following code to work.
import arcpy
arcpy.env.workspace = r"XXXXXXXXXXXXXXXXXXX"
for objFeatureClass in arcpy.ListFeatureClasses():
arcpy.Delete_management(objFeatureClass)
for objTables in arcpy.ListTables():
arcpy.Delete_management(objTables)
print "Process Complete"
If there will be nothing left, just delete the gdb. then recreate it with the same name.
Or is there something else that needs to be maintained?
I was able to get the following code to work.
import arcpy
arcpy.env.workspace = r"XXXXXXXXXXXXXXXXXXX"
for objFeatureClass in arcpy.ListFeatureClasses():
arcpy.Delete_management(objFeatureClass)
for objTables in arcpy.ListTables():
arcpy.Delete_management(objTables)
print "Process Complete"