<?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: Updated Description In All MXD's in a folder/subfolders in Transportation Questions</title>
    <link>https://community.esri.com/t5/transportation-questions/updated-description-in-all-mxd-s-in-a-folder/m-p/126056#M415</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: cdeaner66&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I found another script to do something similar to what I was looking to do and modified it for my needs. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It works (kind of), the only problem is I have 3 mxd's in the folder and it is only updating the last one. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy, os&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Provide folder path to loop through (first level only)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;folderPath = r"C:\TEMP\test"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for filename in os.listdir(folderPath):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; fullpath = os.path.join(folderPath, filename)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if os.path.isfile(fullpath):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; basename, extension = os.path.splitext(fullpath)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if extension.lower() == ".mxd":&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; mxd = arcpy.mapping.MapDocument(fullpath)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; mxd.description&amp;nbsp; = "Python Test Description"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; mxd.save()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del mxd&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Mar 2011 16:44:00 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2011-03-08T16:44:00Z</dc:date>
    <item>
      <title>Updated Description In All MXD's in a folder/subfolders</title>
      <link>https://community.esri.com/t5/transportation-questions/updated-description-in-all-mxd-s-in-a-folder/m-p/126055#M414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: cdeaner66&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;New to Python here so please be patient. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to update the Map Document Properties Description field in hundreds of maps in one folder and multiple sub folders.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I figured out how to add a description to the current map by using the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument ("CURRENT")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.desc = "Description Text Here"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How do I modify this to loop through all the MXD's in my folder/subfolders to update this field in each map?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any insight/help would be appreciated!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2011 13:01:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/updated-description-in-all-mxd-s-in-a-folder/m-p/126055#M414</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2011-03-08T13:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: Updated Description In All MXD's in a folder/subfolders</title>
      <link>https://community.esri.com/t5/transportation-questions/updated-description-in-all-mxd-s-in-a-folder/m-p/126056#M415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: cdeaner66&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I found another script to do something similar to what I was looking to do and modified it for my needs. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It works (kind of), the only problem is I have 3 mxd's in the folder and it is only updating the last one. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy, os&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Provide folder path to loop through (first level only)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;folderPath = r"C:\TEMP\test"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for filename in os.listdir(folderPath):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; fullpath = os.path.join(folderPath, filename)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if os.path.isfile(fullpath):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; basename, extension = os.path.splitext(fullpath)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if extension.lower() == ".mxd":&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; mxd = arcpy.mapping.MapDocument(fullpath)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; mxd.description&amp;nbsp; = "Python Test Description"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; mxd.save()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del mxd&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2011 16:44:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/updated-description-in-all-mxd-s-in-a-folder/m-p/126056#M415</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2011-03-08T16:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: Updated Description In All MXD's in a folder/subfolders</title>
      <link>https://community.esri.com/t5/transportation-questions/updated-description-in-all-mxd-s-in-a-folder/m-p/126057#M416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Let me know how this works for you:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
import glob
import os

# Provide folder path to loop through (first level only)
folderPath = r"C:\TEMP\test"
for filename in glob.glob(os.path.join(folderPath, "*.mxd")):
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Editing", filename
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument(filename)
&amp;nbsp;&amp;nbsp;&amp;nbsp; if not mxd.description:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.description = "Default description"
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.save()
&amp;nbsp;&amp;nbsp;&amp;nbsp; del mxd&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:10:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/updated-description-in-all-mxd-s-in-a-folder/m-p/126057#M416</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2021-12-11T07:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: Updated Description In All MXD's in a folder/subfolders</title>
      <link>https://community.esri.com/t5/transportation-questions/updated-description-in-all-mxd-s-in-a-folder/m-p/126058#M417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: cdeaner66&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the help Jason, it worked great! &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Python is new to me and I appreciate the assistance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2011 20:19:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/updated-description-in-all-mxd-s-in-a-folder/m-p/126058#M417</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2011-03-08T20:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: Updated Description In All MXD's in a folder/subfolders</title>
      <link>https://community.esri.com/t5/transportation-questions/updated-description-in-all-mxd-s-in-a-folder/m-p/126059#M418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The script worked for me as long as the 'description' field was empty.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a way to overwrite an existing description for all MXD's in a folder?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Aug 2011 15:53:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/updated-description-in-all-mxd-s-in-a-folder/m-p/126059#M418</guid>
      <dc:creator>San_Mateo_CountyGIS</dc:creator>
      <dc:date>2011-08-11T15:53:28Z</dc:date>
    </item>
  </channel>
</rss>

