#NEWLINE# def EmptyGDB( pGDB ) : #NEWLINE# #INDENT# arcpy . AddMessage ( ( 'Emptying the contents of ' + pGDB ) ) #NEWLINE# arcpy . env . workspace = dataset #NEWLINE# datasetList = arcpy . ListDatasets ( '*' , '' ) #NEWLINE# datasetList . extend ( arcpy . ListFeatureClasses ( '*' , '' ) ) #NEWLINE# datasetList . extend ( arcpy . ListTables ( '*' , '' ) ) #NEWLINE# for dataset in datasetList : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# arcpy . Delete_management ( dataset ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# arcpy . AddWarning ( ( ( ( 'Could not delete ' + dataset ) + '\n- check for possible locks?\n' ) + str ( sys . exc_info ( ) [ 0 ] ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# arcpy . AddMessage ( ( 'Compacting ' + pGDB ) ) #NEWLINE# try : #NEWLINE# #INDENT# arcpy . Compact_management ( pGDB ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# arcpy . AddWarning ( ( 'Could not compact ' + pGDB ) )