<?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 Tool or script to find all Shapefiles with bad naming conventions in an APRX? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/tool-or-script-to-find-all-shapefiles-with-bad/m-p/1626855#M96863</link>
    <description>&lt;P&gt;As my organization transitions to using Pro for all of our reports, we are bringing along a lot of legacy shapefile and shapefile based workflows. Many of our modelers and scientists use software or python scripts that can only create shapefiles, so we will continue to reference these shapefiles in our ArcGIS Pro projects when creating our reports. Python specifically allows users to create unsupported file and field names with no check to see if they are valid.&lt;/P&gt;&lt;P&gt;Pro will open and display most shapefiles even when they have file names that are too long, with unsupported characters in their file names as well as field names. It is not until you get to a particular query/symbology/editing or geoprocessing process that you run into issues, and often the error message produced is generic and does not let you know that bad shapefile naming practices are to blame. For instance, the Project Package tool that zips up an APRX along with all of the files referenced in the maps ("Share Outside Organization") will fail with "General Function Failure" when your project references shapefiles with bad naming, even though the project was functioning normally.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Is there currently a way, possibly using Python, to scrape all Data Sources in an APRX and to see if any are shapefiles with unsupported file or field names?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I'd like this tool to produce a list of the files at the very least. Ideally it would also tell a user what specifically is unsupported. The logical next tool would take these files and import them into the default project geodatabase, hopefully correcting any of the unsupported naming in the process.&lt;/P&gt;</description>
    <pubDate>Wed, 25 Jun 2025 18:59:40 GMT</pubDate>
    <dc:creator>JoeBryant1</dc:creator>
    <dc:date>2025-06-25T18:59:40Z</dc:date>
    <item>
      <title>Tool or script to find all Shapefiles with bad naming conventions in an APRX?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/tool-or-script-to-find-all-shapefiles-with-bad/m-p/1626855#M96863</link>
      <description>&lt;P&gt;As my organization transitions to using Pro for all of our reports, we are bringing along a lot of legacy shapefile and shapefile based workflows. Many of our modelers and scientists use software or python scripts that can only create shapefiles, so we will continue to reference these shapefiles in our ArcGIS Pro projects when creating our reports. Python specifically allows users to create unsupported file and field names with no check to see if they are valid.&lt;/P&gt;&lt;P&gt;Pro will open and display most shapefiles even when they have file names that are too long, with unsupported characters in their file names as well as field names. It is not until you get to a particular query/symbology/editing or geoprocessing process that you run into issues, and often the error message produced is generic and does not let you know that bad shapefile naming practices are to blame. For instance, the Project Package tool that zips up an APRX along with all of the files referenced in the maps ("Share Outside Organization") will fail with "General Function Failure" when your project references shapefiles with bad naming, even though the project was functioning normally.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Is there currently a way, possibly using Python, to scrape all Data Sources in an APRX and to see if any are shapefiles with unsupported file or field names?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I'd like this tool to produce a list of the files at the very least. Ideally it would also tell a user what specifically is unsupported. The logical next tool would take these files and import them into the default project geodatabase, hopefully correcting any of the unsupported naming in the process.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jun 2025 18:59:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/tool-or-script-to-find-all-shapefiles-with-bad/m-p/1626855#M96863</guid>
      <dc:creator>JoeBryant1</dc:creator>
      <dc:date>2025-06-25T18:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: Tool or script to find all Shapefiles with bad naming conventions in an APRX?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/tool-or-script-to-find-all-shapefiles-with-bad/m-p/1628609#M96958</link>
      <description>&lt;P&gt;Yeah, this can be done with arcpy.&amp;nbsp; The general flow would be something like this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import os
import arcpy

aprx = arcpy.mp.ArcGISProject('CURRENT')
# for all maps in the project
for _map in aprx.listMaps(): 
    # for all layers in the map   
    for _layer in _map.listLayers():
        #if the layer is a shapefile
        if _layer.supports("DATASOURCE"):             
            if _layer.dataSource.endswith('.shp'):
                #check if the shapefile name is valid
                shpPath = _layer.dataSource
                shpName = os.path.splitext(os.path.basename(shpPath))[0]
                shpValid = arcpy.ValidateTableName(shpName,shpPath)
                if shpName != shpValid:
                    #print out any issues
                    print('Shapefile Name "{}" invalid, use "{}" instead'.format(shpName,shpValid))
                #for each field in the shapefile
                for _field in arcpy.ListFields(shpPath):   
                    #check if field name is valid
                    fldName = _field.name
                    fldValid = arcpy.ValidateFieldName(fldName, shpPath)
                    if fldName != fldValid:  
                        #print out any issues
                        print('Shapefile "{}" Field Name "{}" invalid, use "{}" instead'.format(shpName,fldName,fldValid))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Jul 2025 13:42:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/tool-or-script-to-find-all-shapefiles-with-bad/m-p/1628609#M96958</guid>
      <dc:creator>BrennanSmith1</dc:creator>
      <dc:date>2025-07-01T13:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: Tool or script to find all Shapefiles with bad naming conventions in an APRX?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/tool-or-script-to-find-all-shapefiles-with-bad/m-p/1628624#M96959</link>
      <description>&lt;P&gt;Hey Joe,&lt;/P&gt;&lt;P&gt;For a start, use the Arcpy.&lt;STRONG&gt;mp&lt;/STRONG&gt; module.&amp;nbsp; Here is the gist (to get you started; you can expand and tailor as needed) of what I do:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;aprx = arcpy.mp.ArcGISProject('current')
lyt_list = aprx.listLayouts()
lyt_name, ds_list, lyr_name, map_element, map_name = [], [], [], [], []
for lyt in lyt_list:
    el = [e for e in lyt.listElements() if e.type == 'MAPFRAME_ELEMENT']
    for em in el:
        for lyr in em.map.listLayers():
            if lyr.visible:
                lyr_name.append(lyr.name)
                lyt_name.append(lyt.name)
                map_element.append(em.name)
                map_name.append(em.map.name)
                try:
                    ds_list.append(lyr.dataSource)
                except AttributeError:
                    ds_list.append('NA')
            else:
                pass

df = pd.DataFrame(np.column_stack([lyt_name, map_element,map_name, lyr_name, ds_list]),
                  columns = ['layout','map_element','map_name','layer','source'])
df.to_csv(r'path\to\lyR_inventory.csv')&lt;/LI-CODE&gt;&lt;P&gt;this will result in a csv saved in the location from&lt;/P&gt;&lt;BLOCKQUOTE&gt;df.to_csv(path/to/lyR_inventory.csv)&lt;/BLOCKQUOTE&gt;&lt;P class=""&gt;I have a Python Toolbox built already that you are free to use:&amp;nbsp;&amp;nbsp;&lt;A title="pro_project_utils Python Toolbox" href="https://github.com/zuhlmann/arcgis/blob/master/arcpy_script_tools_uhlmann/pro_project_utils.pyt" target="_self"&gt;pro_project_utils (Python Toolbox)&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The first tool will inventory all Layouts in a Project (aprx) and which maps are used in it.&lt;/LI&gt;&lt;LI&gt;The second tool is what you want, it inventories all layers in all maps contained in a Project (aprx).&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2025-06-30 140638.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/135439iA21B03073AF0EB85/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2025-06-30 140638.png" alt="Screenshot 2025-06-30 140638.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I believe I can document the arguments, etc to display in the toolbox so you can click and determine arguments and outputs.&amp;nbsp; If you intend to use, let me know and I will update on GitHub.&amp;nbsp; But in general here are the arguments for&amp;nbsp;&lt;STRONG&gt;Layer Inventory for Map Elements&amp;nbsp;&lt;/STRONG&gt;(second tool).&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Click "Current Pro Document" if you are using tool within the Project to inventory&lt;/LI&gt;&lt;LI&gt;Otherwise, provide &lt;EM&gt;path/to/aprx&lt;/EM&gt; in&amp;nbsp;&lt;STRONG&gt;Other Pro-Document&lt;/STRONG&gt; argument&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;path/to/...formatted table&lt;/STRONG&gt; will be a DIRECTORY where inventories (.csv) will be saved.&amp;nbsp; Note, if&amp;nbsp;&lt;STRONG&gt;Unique Layer Inventory&lt;/STRONG&gt; is checked, then there will be two inventories (&lt;EM&gt;see last bullet)&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;File&lt;/STRONG&gt; &lt;STRONG&gt;Name&amp;nbsp;&lt;/STRONG&gt;can be a &amp;lt;filename&amp;gt;.csv or simply &amp;lt;filename&amp;gt; and the output will be a .csv&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Unique Layer Inventory&lt;/STRONG&gt; fairly certain this will have one row per feature/.shp/.tif/file visible (i.e. checked to diplay) in Table of Contents for every map used in a Layout in specified project.&amp;nbsp; Note that in this situation, TWO .csv will be exported, one with unique layers and one with all layer listed for each map.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Screenshot 2025-06-30 140647.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/135449i24DD974D71310A5B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2025-06-30 140647.png" alt="Screenshot 2025-06-30 140647.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is what the lyR_inventory.csv will look like.&amp;nbsp; This is a curated subset.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;layout&lt;/STRONG&gt; = name of layout&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;map_name&lt;/STRONG&gt; = map name&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;layer&lt;/STRONG&gt; = layer name from Table of Contents&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;source&amp;nbsp;&lt;/STRONG&gt;= this is what you want &lt;STRONG&gt;(!!!!!&lt;/STRONG&gt;) - the actual Data Source.&amp;nbsp; Here is where you can further view and identify problematic shapefiles, feature classes, etc.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;map_element&amp;nbsp;&lt;/STRONG&gt;= the mane of map element in the layout&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Screenshot 2025-06-30 142607.png" style="width: 200px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/135453i3FDA83E78E2EC88C/image-size/small?v=v2&amp;amp;px=200" role="button" title="Screenshot 2025-06-30 142607.png" alt="Screenshot 2025-06-30 142607.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE width="895"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="259"&gt;&lt;STRONG&gt;layout&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="110"&gt;&lt;STRONG&gt;map_element&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="229"&gt;&lt;STRONG&gt;map_name&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="233"&gt;&lt;STRONG&gt;layer&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="64"&gt;&lt;STRONG&gt;source&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;fall_cr_site_visit_march2023_private_prop&lt;/TD&gt;&lt;TD&gt;Map Frame&lt;/TD&gt;&lt;TD&gt;fall_cr_visit_march2023&lt;/TD&gt;&lt;TD&gt;shasta_trail&lt;/TD&gt;&lt;TD&gt;C:\Documents\20250627_shasta_trail\shasta_trail.shp&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;fall_cr_site_visit_march2023_private_prop&lt;/TD&gt;&lt;TD&gt;Map Frame&lt;/TD&gt;&lt;TD&gt;fall_cr_visit_march2023&lt;/TD&gt;&lt;TD&gt;access_routes_v3&lt;/TD&gt;&lt;TD&gt;C:\other_folder\mapping.gdb\access_routes\access_routes_v3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;keno_parcels&lt;/TD&gt;&lt;TD&gt;Map Frame&lt;/TD&gt;&lt;TD&gt;keno_parcels&lt;/TD&gt;&lt;TD&gt;parcels_master_rectified_formatted&lt;/TD&gt;&lt;TD&gt;C:\other_folder\mapping.gdb\base_layers\parcels_master_rectified_formatted&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;keno_parcels&lt;/TD&gt;&lt;TD&gt;Map Frame&lt;/TD&gt;&lt;TD&gt;keno_parcels&lt;/TD&gt;&lt;TD&gt;World Imagery&lt;/TD&gt;&lt;TD&gt;&lt;A href="https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer" target="_blank" rel="noopener"&gt;https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;shasta_trail_work&lt;/TD&gt;&lt;TD&gt;Map Frame 1&lt;/TD&gt;&lt;TD&gt;Map&lt;/TD&gt;&lt;TD&gt;shasta_trail&lt;/TD&gt;&lt;TD&gt;C:\Documents\20250627_shasta_trail\shasta_trail.shp&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;shasta_trail_work&lt;/TD&gt;&lt;TD&gt;Map Frame&lt;/TD&gt;&lt;TD&gt;shasta_trail_work_2025&lt;/TD&gt;&lt;TD&gt;City of Yreka&lt;/TD&gt;&lt;TD&gt;C:\other_folder\\mapping.gdb\legend\legend_item_poly&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;shasta_trail_work&lt;/TD&gt;&lt;TD&gt;Map Frame&lt;/TD&gt;&lt;TD&gt;shasta_trail_work_2025&lt;/TD&gt;&lt;TD&gt;lkp_master_labels&lt;/TD&gt;&lt;TD&gt;C:\other_folder\\master.gdb\labels\lkp_master_labels&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;shasta_trail_work&lt;/TD&gt;&lt;TD&gt;Map Frame&lt;/TD&gt;&lt;TD&gt;shasta_trail_work_2025&lt;/TD&gt;&lt;TD&gt;World Imagery&lt;/TD&gt;&lt;TD&gt;&lt;A href="https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer" target="_blank" rel="noopener"&gt;https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;jcb_parcels_blm&lt;/TD&gt;&lt;TD&gt;Map Frame&lt;/TD&gt;&lt;TD&gt;keno_parcels&lt;/TD&gt;&lt;TD&gt;parcels_master_rectified_formatted&lt;/TD&gt;&lt;TD&gt;C:\other_folder\\mapping.gdb\base_layers\parcels_master_rectified_formatted&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;jcb_parcels_blm&lt;/TD&gt;&lt;TD&gt;Map Frame&lt;/TD&gt;&lt;TD&gt;keno_parcels&lt;/TD&gt;&lt;TD&gt;parcels_master_rectified_formatted&lt;/TD&gt;&lt;TD&gt;C:\other_folder\\mapping.gdb\base_layers\parcels_master_rectified_formatted&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;jcb_parcels_blm&lt;/TD&gt;&lt;TD&gt;Map Frame&lt;/TD&gt;&lt;TD&gt;keno_parcels&lt;/TD&gt;&lt;TD&gt;World Imagery&lt;/TD&gt;&lt;TD&gt;&lt;A href="https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer" target="_blank" rel="noopener"&gt;https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;fall_cr_site_visit_march2023&lt;/TD&gt;&lt;TD&gt;Map Frame&lt;/TD&gt;&lt;TD&gt;fall_cr_visit_march2023&lt;/TD&gt;&lt;TD&gt;shasta_trail&lt;/TD&gt;&lt;TD&gt;C:\Documents\20250627_shasta_trail\shasta_trail.shp&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;fall_cr_site_visit_march2023&lt;/TD&gt;&lt;TD&gt;Map Frame&lt;/TD&gt;&lt;TD&gt;fall_cr_visit_march2023&lt;/TD&gt;&lt;TD&gt;access_routes_v3&lt;/TD&gt;&lt;TD&gt;C:\other_folder\\mapping.gdb\access_routes\access_routes_v3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;fall_cr_site_visit_march2023&lt;/TD&gt;&lt;TD&gt;Map Frame&lt;/TD&gt;&lt;TD&gt;fall_cr_visit_march2023&lt;/TD&gt;&lt;TD&gt;Lake_Surfaces&lt;/TD&gt;&lt;TD&gt;C:\other_folder\\master.gdb\hydrology\Lake_Surfaces&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jun 2025 20:30:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/tool-or-script-to-find-all-shapefiles-with-bad/m-p/1628624#M96959</guid>
      <dc:creator>ZacharyUhlmann1</dc:creator>
      <dc:date>2025-06-30T20:30:52Z</dc:date>
    </item>
  </channel>
</rss>

