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
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.