<?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: shapefiles had been renamed in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/shapefiles-had-been-renamed/m-p/490129#M38356</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Randy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just tried this script and it worked! Thank you very much. &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;I also made a dictionary for renaming a bunch of shapefiles as you recommended. Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jerome&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Jan 2018 10:09:26 GMT</pubDate>
    <dc:creator>jeromeazul</dc:creator>
    <dc:date>2018-01-18T10:09:26Z</dc:date>
    <item>
      <title>shapefiles had been renamed</title>
      <link>https://community.esri.com/t5/python-questions/shapefiles-had-been-renamed/m-p/490121#M38348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV class="" style="background: transparent; border: 0px; text-decoration: none; font-size: 14px;"&gt;&lt;DIV class="" style="color: inherit; background: transparent; border-width: 1px 0px 0px; border-style: solid initial initial initial; border-color: rgba(0, 0, 0, 0.1) initial initial initial; font-weight: 500; text-decoration: none; font-size: 0.8571rem; padding: 15px 30px;"&gt;&lt;P style="font-weight: 400; padding: 0px;"&gt;Howdy!&lt;/P&gt;&lt;P style="font-weight: 400; padding: 0px;"&gt;&lt;/P&gt;&lt;P style="font-weight: 400; padding: 0px;"&gt;I had a bunch of shp files inputted in my mxds. and we renamed these shp files and the link in my mxds got broken. The easiest way is to open the mxd, set the data source and click the renamed shp files or use the arc catalog. However, I need to do the fixing of broken links to 700 mxds., this can be overwhelming. I am trying to find a python code/script that can be used in order to fix these broken links but unfortunately, I can't find any that works. Can anyone help me with this? It will be greatly appreciated if anyone can give me a script for this.&amp;nbsp;&lt;/P&gt;&lt;P style="font-weight: 400; padding: 0px;"&gt;&lt;/P&gt;&lt;P style="font-weight: 400; padding: 0px;"&gt;Ps: I tried using this script from&amp;nbsp;&lt;A class="" href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00s30000004p000000" style="color: #2989c5; text-decoration: none;" title="http://resources.arcgis.com/en/help/main/10.1/index.html#//00s30000004p000000"&gt;ArcGIS Help 10.1&lt;/A&gt;&amp;nbsp;but it is not working&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;P style="font-weight: 400; padding: 0px;"&gt;&lt;/P&gt;&lt;PRE style="color: #4d4d4d; background-color: #eeeeee; border: 1px dashed #c2c4ba; font-size: 11.44px; margin: 0px 0px 0px 15px; padding: 10px 10px 25px;"&gt;&lt;CODE style="border: 0px; font-size: 11.44px;"&gt;&lt;SPAN class="" style="color: #0000ff; border: 0px; font-size: 11.44px;"&gt;import&lt;/SPAN&gt; &lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;mxd&lt;/SPAN&gt; &lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;mapping&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;MapDocument&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #a31515; border: 0px; font-size: 11.44px;"&gt;r"C:\Project\Project.mxd"&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #0000ff; border: 0px; font-size: 11.44px;"&gt;for&lt;/SPAN&gt; &lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;lyr&lt;/SPAN&gt; &lt;SPAN class="" style="color: #0000ff; border: 0px; font-size: 11.44px;"&gt;in&lt;/SPAN&gt; &lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;mapping&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;ListBrokenDataSources&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;mxd&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;):&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="" style="color: #0000ff; border: 0px; font-size: 11.44px;"&gt;if&lt;/SPAN&gt; &lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;lyr&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;supports&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #a31515; border: 0px; font-size: 11.44px;"&gt;"DATASOURCE"&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;):&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="" style="color: #0000ff; border: 0px; font-size: 11.44px;"&gt;if&lt;/SPAN&gt; &lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;lyr&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;dataSource&lt;/SPAN&gt; &lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;==&lt;/SPAN&gt; &lt;SPAN class="" style="color: #a31515; border: 0px; font-size: 11.44px;"&gt;r"C:\Project\Data\Transportation.gdb\MajorRoads"&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;:&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;lyr&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;replaceDataSource&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #a31515; border: 0px; font-size: 11.44px;"&gt;r"C:\Project\Data\Transportation.gdb"&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: #a31515; border: 0px; font-size: 11.44px;"&gt;"FILEGDB_WORKSPACE"&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: #a31515; border: 0px; font-size: 11.44px;"&gt;"Highways"&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;)&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;lyr&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;name&lt;/SPAN&gt; &lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="" style="color: #a31515; border: 0px; font-size: 11.44px;"&gt;"Highways"&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;mxd&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;saveACopy&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #a31515; border: 0px; font-size: 11.44px;"&gt;r"C:\Project\Project2.mxd"&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #0000ff; border: 0px; font-size: 11.44px;"&gt;del&lt;/SPAN&gt; &lt;SPAN class="" style="border: 0px; font-size: 11.44px;"&gt;mxd&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P style="font-weight: 400; padding: 0px;"&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jan 2018 09:28:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shapefiles-had-been-renamed/m-p/490121#M38348</guid>
      <dc:creator>jeromeazul</dc:creator>
      <dc:date>2018-01-12T09:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: shapefiles had been renamed</title>
      <link>https://community.esri.com/t5/python-questions/shapefiles-had-been-renamed/m-p/490122#M38349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you have version 10.1? What is not working, any error messages? You will probably have to create a loop through the MXD's and&amp;nbsp;specify what the old and new location and names of the shapefile are.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jan 2018 15:23:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shapefiles-had-been-renamed/m-p/490122#M38349</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2018-01-12T15:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: shapefiles had been renamed</title>
      <link>https://community.esri.com/t5/python-questions/shapefiles-had-been-renamed/m-p/490123#M38350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That code won't work without modification since you have to provide the paths to the projects (mxd's) and their data if the location of the data are not 'relative' to the projects.&amp;nbsp; Renaming them along the way is going to further complicate things.&amp;nbsp; Do you have some sort of 'old-new' name key that can facilitate the move?&lt;/P&gt;&lt;P&gt;If the number of projects to fix greatly outnumbers the number of shapefiles you renamed, then it may be best to backtrack and rename them back to their original names, until you can get the rest of this resolved.&lt;/P&gt;&lt;P&gt;It would be discouraging that renaming 3 shapefiles ruined 700 projects.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 14 Jan 2018 04:25:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shapefiles-had-been-renamed/m-p/490123#M38350</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-01-14T04:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: shapefiles had been renamed</title>
      <link>https://community.esri.com/t5/python-questions/shapefiles-had-been-renamed/m-p/490124#M38351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As &lt;A href="https://community.esri.com/migrated-users/3116"&gt;Dan Patterson&lt;/A&gt;‌ mentioned, with whatever script you find, you will need to some modifications.&amp;nbsp; It sounds like you will want to start with a loop to find all your MXDs, and then loop through the feature layers in each file.&amp;nbsp; Here's a code example that might be of interest: &lt;A _jive_internal="true" href="https://community.esri.com/thread/189786-write-broken-source-list-to-text-file"&gt;Write Broken Source List to Text File&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you explain a bit more about your situation.&amp;nbsp; I am assuming that you are working with shape files (ending in .shp) and not a feature in a geodatabase.&amp;nbsp; Were the shape files moved, renamed or both?&amp;nbsp; If they were renamed, was there a logic/process to the renaming that can be written&amp;nbsp;with code?&amp;nbsp; If the files were moved, again, was there specific process used?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jan 2018 04:42:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shapefiles-had-been-renamed/m-p/490124#M38351</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2018-01-15T04:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: shapefiles had been renamed</title>
      <link>https://community.esri.com/t5/python-questions/shapefiles-had-been-renamed/m-p/490125#M38352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Randy,&lt;/P&gt;&lt;P&gt;Thanks for this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes,&amp;nbsp; we are working with shp files and not with features in a geodatabase.&amp;nbsp;&lt;/P&gt;&lt;P&gt;We're here in this situation where we have a shp file named "earthquake_&lt;STRONG&gt;PHI&lt;/STRONG&gt;.shp", and we renamed it to "earthquake_&lt;STRONG&gt;PHL&lt;/STRONG&gt;.shp". This shapefile was used in over 700 mxds. we checked these&amp;nbsp;mxds, and the links got broken. We wanted to find a way on how to set the data source again but with the newly renamed shpfile.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;"Was there a&amp;nbsp;process to the renaming that can be code?"&lt;/EM&gt;&lt;/STRONG&gt; We just renamed the shp and its extensions (.dbf, .shx, etc) manually inside a folder.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have another situation where we&amp;nbsp;didn't rename the shpfile&amp;nbsp;(&lt;SPAN&gt;"earthquake_&lt;/SPAN&gt;&lt;STRONG&gt;PHI&lt;/STRONG&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;shp&lt;SPAN&gt;") anymore, instead we 'save as' another file called&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;"earthquake_&lt;STRONG&gt;PHL&lt;/STRONG&gt;&lt;SPAN&gt;.shp". In this case, we have now 2 shapefiles. Checking the mxds, links are not broken&amp;nbsp;but the layer in mxd still has the old shapefile as&amp;nbsp;its source, but we wanted to change it to the new shapefile&amp;nbsp;by setting the data source. Is this possible with a script to set the data source in 700 mxds?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Thank you very much!&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jan 2018 06:24:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shapefiles-had-been-renamed/m-p/490125#M38352</guid>
      <dc:creator>jeromeazul</dc:creator>
      <dc:date>2018-01-15T06:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: shapefiles had been renamed</title>
      <link>https://community.esri.com/t5/python-questions/shapefiles-had-been-renamed/m-p/490126#M38353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Xander,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, i run the code in version 10.1 and even tried it in version 10.3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We modify the code by specifying the old and new locations and names of the shapefiles and we run the code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code works fine and there are no error messages, however, when we check the mxds, links are still broken. &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jan 2018 06:31:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shapefiles-had-been-renamed/m-p/490126#M38353</guid>
      <dc:creator>jeromeazul</dc:creator>
      <dc:date>2018-01-15T06:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: shapefiles had been renamed</title>
      <link>https://community.esri.com/t5/python-questions/shapefiles-had-been-renamed/m-p/490127#M38354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;Hello Dan,&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;Thanks for this.&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;this is our situation, we have a shp file named "earthquake_&lt;STRONG style="border: 0px; font-weight: bold; font-size: 14px;"&gt;PHI&lt;/STRONG&gt;.shp", and we renamed it manually to "earthquake_&lt;STRONG style="border: 0px; font-weight: bold; font-size: 14px;"&gt;PHL&lt;/STRONG&gt;.shp". This shapefile was used in over 700 mxds. we checked these&amp;nbsp;mxds, and the links got broken. We wanted to find a way on how to set the data source again but with the newly renamed shpfile.&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;By the way, we still need to rename 70 shapefiles. &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;Thank you very much!&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jan 2018 06:37:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shapefiles-had-been-renamed/m-p/490127#M38354</guid>
      <dc:creator>jeromeazul</dc:creator>
      <dc:date>2018-01-15T06:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: shapefiles had been renamed</title>
      <link>https://community.esri.com/t5/python-questions/shapefiles-had-been-renamed/m-p/490128#M38355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it is a simple rename all "earthquake_PHI" to "earthquake_PHL", then this may give you an idea.&amp;nbsp; If it is a bunch of renames, you may need to use a dictionary in the renaming.&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os
&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; arcpy &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; env

&lt;SPAN class="comment token"&gt;# path to search for mxd&lt;/SPAN&gt;
path &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r'C&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;\Path\To\Use"

oldShp &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"earthquake_PHI"&lt;/SPAN&gt;&amp;nbsp; &lt;SPAN class="comment token"&gt;# old shapefile name without extension&lt;/SPAN&gt;
newShp &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"earthquake_PHL"&lt;/SPAN&gt;&amp;nbsp; &lt;SPAN class="comment token"&gt;# for replaceDataSource - does not use ".shp"&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# iterates through folder searching for mxds&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; fileName &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listdir&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; fullPath &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;fileName&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;isfile&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fullPath&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;and&lt;/SPAN&gt; fileName&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;3&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;lower&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'mxd'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MapDocument&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fullPath&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; fullPath
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; lyr &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListLayers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;supports&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"DATASOURCE"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; oldShp &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dataSource&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"\t"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dataSource
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shpPath &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dirname&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dataSource&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"\t"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; shpPath
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shpFile &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;basename&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dataSource&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"\t"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; shpFile
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;# this will replace the data source in the mxd&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replaceDataSource&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;shpPath&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"SHAPEFILE_WORKSPACE"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; newShp&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;# if layer needs to be renamed&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; newShp 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;save&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# save mxd changes, perhaps use:&amp;nbsp; mxd.saveACopy(r"C:\Project\Output\\" + newname + ".mxd")&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;del&lt;/SPAN&gt; mxd&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:34:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shapefiles-had-been-renamed/m-p/490128#M38355</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-11T21:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: shapefiles had been renamed</title>
      <link>https://community.esri.com/t5/python-questions/shapefiles-had-been-renamed/m-p/490129#M38356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Randy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just tried this script and it worked! Thank you very much. &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;I also made a dictionary for renaming a bunch of shapefiles as you recommended. Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jerome&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jan 2018 10:09:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shapefiles-had-been-renamed/m-p/490129#M38356</guid>
      <dc:creator>jeromeazul</dc:creator>
      <dc:date>2018-01-18T10:09:26Z</dc:date>
    </item>
  </channel>
</rss>

