Hello all,
I am new to Arcgis and python scripting ,
I have a database and I want to delete all temporary created rasters in it. Doe's anybody know how to perform this task by python code?
I haven't tested the code, but I guess this should work:
import arcpy # settings gdb = r"C:\Path\to\your\FileGeodatabase.gdb" arcpy.env.workspace = gdb # create a list of rasters in the folder rasters = arcpy.ListRasters() # loop through raster in list for raster in rasters: try: arcpy.Delete_management(raster) except: print "Raster '{0}' could not be deleted".format(raster)
Kind regards, Xander
Thank you Xander. The code works!
Sara
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.