<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic delete multiple rasters in stand-alone Python script in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/delete-multiple-rasters-in-stand-alone-python/m-p/514403#M40366</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is it possible to use delete_management with a wildcard?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i.e. I want to delete all rasters that start with say "aPrefix_" in a workspace.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Or do I need to make a list and then loop through that list?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ray&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Oct 2013 13:42:43 GMT</pubDate>
    <dc:creator>RayJahncke</dc:creator>
    <dc:date>2013-10-09T13:42:43Z</dc:date>
    <item>
      <title>delete multiple rasters in stand-alone Python script</title>
      <link>https://community.esri.com/t5/python-questions/delete-multiple-rasters-in-stand-alone-python/m-p/514403#M40366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is it possible to use delete_management with a wildcard?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i.e. I want to delete all rasters that start with say "aPrefix_" in a workspace.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Or do I need to make a list and then loop through that list?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ray&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Oct 2013 13:42:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/delete-multiple-rasters-in-stand-alone-python/m-p/514403#M40366</guid>
      <dc:creator>RayJahncke</dc:creator>
      <dc:date>2013-10-09T13:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: delete multiple rasters in stand-alone Python script</title>
      <link>https://community.esri.com/t5/python-questions/delete-multiple-rasters-in-stand-alone-python/m-p/514404#M40367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Ray,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;As you are guessing, the easiest way would be to create a list and then loop through the list of data. It's pretty straightforward. Some sample code would be:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

workspace = r'c:\data'
arcpy.env.workspace = workspace

datasets = arcpy.ListFeatureClasses("prefix_*")
for dataset in datasets:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(dataset)

print "done deleting datasets"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Of course, the arcpy List function would depend on what type of data you are looking for.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:29:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/delete-multiple-rasters-in-stand-alone-python/m-p/514404#M40367</guid>
      <dc:creator>StevenEnsing</dc:creator>
      <dc:date>2021-12-11T22:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: delete multiple rasters in stand-alone Python script</title>
      <link>https://community.esri.com/t5/python-questions/delete-multiple-rasters-in-stand-alone-python/m-p/514405#M40368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Perfect! Thanks Steven.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Oct 2013 17:16:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/delete-multiple-rasters-in-stand-alone-python/m-p/514405#M40368</guid>
      <dc:creator>RayJahncke</dc:creator>
      <dc:date>2013-10-11T17:16:42Z</dc:date>
    </item>
  </channel>
</rss>

