<?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 Re: ArcPro Script Tool parameter for a variety of file types in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpro-script-tool-parameter-for-a-variety-of-file/m-p/1665204#M74894</link>
    <description>&lt;P&gt;OK what would be genuine examples of the two input parameters?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;    oldzip = arcpy.GetParameterAsText(0)
    workspace_folder = arcpy.GetParameterAsText(1)&lt;/LI-CODE&gt;&lt;P&gt;Also setting parameter zero to be a File AND&amp;nbsp; a Shapefile AND a Folder makes no sense to me, should it not simply be File with your filter set?&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Properties &amp;gt; Parameter 0: Data Type &amp;gt; File &amp;gt; Filter File (zip; shp)&lt;/LI&gt;&lt;LI&gt;&lt;STRIKE&gt;Properties &amp;gt; Parameter 0: Data Type &amp;gt; Shapefile&lt;/STRIKE&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRIKE&gt;Properties &amp;gt; Parameter 0: Data Type &amp;gt; Folder&lt;/STRIKE&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
    <pubDate>Wed, 12 Nov 2025 17:59:35 GMT</pubDate>
    <dc:creator>DuncanHornby</dc:creator>
    <dc:date>2025-11-12T17:59:35Z</dc:date>
    <item>
      <title>ArcPro Script Tool parameter for a variety of file types</title>
      <link>https://community.esri.com/t5/python-questions/arcpro-script-tool-parameter-for-a-variety-of-file/m-p/1665162#M74891</link>
      <description>&lt;LI-CODE lang="python"&gt;import arcpy,os

# delete old zips
def delete_old_parcels_zip(oldzip, workspace_folder):
    arcpy.env.workspace = workspace_folder
    # r=root, d=directories, f=files
    for root, directories, files in os.walk(workspace_folder):
        for file in files:
            if file.endswith(oldzip): #.endswith accepts a tupule
                #delete existing zips from folder
                print("old zips deleted: {}".format(file))
                arcpy.AddMessage("old zips deleted: {}".format(file))
                arcpy.Delete_management(file)

if __name__ == "__main__":
    #name of zip file with extension
    oldzip = arcpy.GetParameterAsText(0)

    # output folder
    workspace_folder = arcpy.GetParameterAsText(1)

    # delete
    delete_old_parcels_zip(oldzip, workspace_folder)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having trouble getting this script to work as a script tool. It works fine as a stand-alone. I've tried a number of things in Pro Catalog Toolboxes:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Properties &amp;gt; Execution panel &amp;gt; embedded&lt;/LI&gt;&lt;LI&gt;Properties &amp;gt; Execution panel &amp;gt; external script&lt;/LI&gt;&lt;LI&gt;Properties &amp;gt; Parameter 0: Data Type &amp;gt; File &amp;gt; Filter File (zip; shp)&lt;/LI&gt;&lt;LI&gt;Properties &amp;gt; Parameter 0: Data Type &amp;gt; Shapefile&lt;/LI&gt;&lt;LI&gt;Properties &amp;gt; Parameter 0: Data Type &amp;gt; Folder&lt;/LI&gt;&lt;LI&gt;Properties &amp;gt; Parameter 1: Data Type &amp;gt; Workspace&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;It doesn't throw any errors. But it produces no results. Basically, the tool is supposed to find a file based on user input and in the workspace and delete it. &lt;STRONG&gt;Note:&lt;/STRONG&gt; I'm after learning to use&amp;nbsp;&lt;EM&gt;if __name__ == "__main__"&amp;nbsp;&lt;/EM&gt;in a script tool.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Nov 2025 16:37:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpro-script-tool-parameter-for-a-variety-of-file/m-p/1665162#M74891</guid>
      <dc:creator>JaredPilbeam2</dc:creator>
      <dc:date>2025-11-12T16:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPro Script Tool parameter for a variety of file types</title>
      <link>https://community.esri.com/t5/python-questions/arcpro-script-tool-parameter-for-a-variety-of-file/m-p/1665194#M74892</link>
      <description>&lt;P&gt;OK when you run it does it print your "old zip files deleted message" but nothing happens?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Nov 2025 17:28:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpro-script-tool-parameter-for-a-variety-of-file/m-p/1665194#M74892</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2025-11-12T17:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPro Script Tool parameter for a variety of file types</title>
      <link>https://community.esri.com/t5/python-questions/arcpro-script-tool-parameter-for-a-variety-of-file/m-p/1665199#M74893</link>
      <description>&lt;P&gt;No, no print messages.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Nov 2025 17:46:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpro-script-tool-parameter-for-a-variety-of-file/m-p/1665199#M74893</guid>
      <dc:creator>JaredPilbeam2</dc:creator>
      <dc:date>2025-11-12T17:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPro Script Tool parameter for a variety of file types</title>
      <link>https://community.esri.com/t5/python-questions/arcpro-script-tool-parameter-for-a-variety-of-file/m-p/1665204#M74894</link>
      <description>&lt;P&gt;OK what would be genuine examples of the two input parameters?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;    oldzip = arcpy.GetParameterAsText(0)
    workspace_folder = arcpy.GetParameterAsText(1)&lt;/LI-CODE&gt;&lt;P&gt;Also setting parameter zero to be a File AND&amp;nbsp; a Shapefile AND a Folder makes no sense to me, should it not simply be File with your filter set?&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Properties &amp;gt; Parameter 0: Data Type &amp;gt; File &amp;gt; Filter File (zip; shp)&lt;/LI&gt;&lt;LI&gt;&lt;STRIKE&gt;Properties &amp;gt; Parameter 0: Data Type &amp;gt; Shapefile&lt;/STRIKE&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRIKE&gt;Properties &amp;gt; Parameter 0: Data Type &amp;gt; Folder&lt;/STRIKE&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Wed, 12 Nov 2025 17:59:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpro-script-tool-parameter-for-a-variety-of-file/m-p/1665204#M74894</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2025-11-12T17:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPro Script Tool parameter for a variety of file types</title>
      <link>https://community.esri.com/t5/python-questions/arcpro-script-tool-parameter-for-a-variety-of-file/m-p/1665228#M74895</link>
      <description>&lt;P&gt;Two examples of input:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;oldzip = 'WillCounty_Street.zip'
workspace_folder = r'C:\Users\jpilbeam\test'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for asking. So, the end-user of this tool would input files to delete in the first parameter. The files in the workspace folder could be either a *.zip, *.shp or *.pdf. What I was pointing out was the separate scenarios I've tried . As in, what I've tried was:&lt;/P&gt;&lt;P&gt;- setting the Data Type to File&lt;/P&gt;&lt;P&gt;- setting the Data Type to File, and File Filter to zip; shp&lt;/P&gt;&lt;P&gt;- setting the Data Type to Shapefile&lt;/P&gt;&lt;P&gt;- setting the Data Type to folder. --This didn't make much sense, but i tried it anyway.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Nov 2025 18:52:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpro-script-tool-parameter-for-a-variety-of-file/m-p/1665228#M74895</guid>
      <dc:creator>JaredPilbeam2</dc:creator>
      <dc:date>2025-11-12T18:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPro Script Tool parameter for a variety of file types</title>
      <link>https://community.esri.com/t5/python-questions/arcpro-script-tool-parameter-for-a-variety-of-file/m-p/1665241#M74896</link>
      <description>&lt;P&gt;try,&lt;/P&gt;&lt;LI-CODE lang="c"&gt;for root, directories, files in os.walk(workspace_folder):
        for file in files:
            if file == oldzip or file.endswith(oldzip):
                file_path = os.path.join(root, file) #should pass the full path
                print(f"Old zip deleted: {file_path}")
                arcpy.AddMessage(f"Old zip deleted: {file_path}")
                arcpy.Delete_management(file_path)
                deleted_files += 1&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 12 Nov 2025 19:40:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpro-script-tool-parameter-for-a-variety-of-file/m-p/1665241#M74896</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2025-11-12T19:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPro Script Tool parameter for a variety of file types</title>
      <link>https://community.esri.com/t5/python-questions/arcpro-script-tool-parameter-for-a-variety-of-file/m-p/1665465#M74897</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/3265"&gt;@TonyAlmeida&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, that works on its own (without += operator) but embedded in the script tool with the same input as before it runs but doesn't delete and no print statements in tool.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe the issue lies with the script tool data type parameter for file. I'm going to concentrate on that.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JaredPilbeam2_0-1763046213909.png" style="width: 601px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/143687i6FC86CB661811ED6/image-dimensions/601x383?v=v2" width="601" height="383" role="button" title="JaredPilbeam2_0-1763046213909.png" alt="JaredPilbeam2_0-1763046213909.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Tool interface:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JaredPilbeam2_1-1763046445187.png" style="width: 603px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/143688i82975037D2B8D022/image-dimensions/603x229?v=v2" width="603" height="229" role="button" title="JaredPilbeam2_1-1763046445187.png" alt="JaredPilbeam2_1-1763046445187.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Nov 2025 15:11:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpro-script-tool-parameter-for-a-variety-of-file/m-p/1665465#M74897</guid>
      <dc:creator>JaredPilbeam2</dc:creator>
      <dc:date>2025-11-13T15:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPro Script Tool parameter for a variety of file types</title>
      <link>https://community.esri.com/t5/python-questions/arcpro-script-tool-parameter-for-a-variety-of-file/m-p/1665522#M74898</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/3515"&gt;@DuncanHornby&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/3265"&gt;@TonyAlmeida&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It worked with the&amp;nbsp;&lt;EM&gt;arcpy.GetParameter()&amp;nbsp;&lt;/EM&gt;function and the Data Type parameter set to String. I used the index&amp;nbsp;&lt;EM&gt;0&lt;/EM&gt;. I was able to run the tool numerous times on the following files and it deleted all of them: *.zip, *.shp, *.png, *.jpeg. So:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JaredPilbeam2_0-1763050818834.png" style="width: 690px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/143719i3841E9A35116A5DE/image-dimensions/690x149?v=v2" width="690" height="149" role="button" title="JaredPilbeam2_0-1763050818834.png" alt="JaredPilbeam2_0-1763050818834.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;if __name__ == "__main__":
    #name of zip file with extension
    oldzip = arcpy.GetParameter(0)

    # output folder
    workspace_folder = arcpy.GetParameterAsText(1)

    # delete
    delete_old_parcels_zip(oldzip, workspace_folder)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Nov 2025 16:23:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpro-script-tool-parameter-for-a-variety-of-file/m-p/1665522#M74898</guid>
      <dc:creator>JaredPilbeam2</dc:creator>
      <dc:date>2025-11-13T16:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPro Script Tool parameter for a variety of file types</title>
      <link>https://community.esri.com/t5/python-questions/arcpro-script-tool-parameter-for-a-variety-of-file/m-p/1665524#M74899</link>
      <description>&lt;P&gt;I was just getting ready to indicate the parameter 0 has to be GetParameterAsText and as to be string.&amp;nbsp;&amp;nbsp;I tested it on my end.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Nov 2025 16:31:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpro-script-tool-parameter-for-a-variety-of-file/m-p/1665524#M74899</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2025-11-13T16:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPro Script Tool parameter for a variety of file types</title>
      <link>https://community.esri.com/t5/python-questions/arcpro-script-tool-parameter-for-a-variety-of-file/m-p/1665540#M74900</link>
      <description>&lt;P&gt;Nice. Yeah, it doesn't make a difference if parameter 0 is&amp;nbsp;&lt;EM&gt;GetParameter()&amp;nbsp;&lt;/EM&gt;or&amp;nbsp;&lt;EM&gt;GetParameterAsText()&lt;/EM&gt;. Both work. It's only the Data Type that needed changed.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Nov 2025 16:46:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpro-script-tool-parameter-for-a-variety-of-file/m-p/1665540#M74900</guid>
      <dc:creator>JaredPilbeam2</dc:creator>
      <dc:date>2025-11-13T16:46:46Z</dc:date>
    </item>
  </channel>
</rss>

