<?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: Using Python to Export all MXD's in a Directory in ArcGIS Enterprise Portal Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/using-python-to-export-all-mxd-s-in-a-directory/m-p/577302#M7867</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jeff,&amp;nbsp; this works almost perfectly. In testing, it created PDF's out all my MXD's in a folder,&amp;nbsp; but is it possible to output to a &lt;SPAN style="text-decoration: underline;"&gt;&lt;EM&gt;different&lt;/EM&gt; &lt;/SPAN&gt;folder?&amp;nbsp; I tried messing around with your code but I don't have enough knowledge to get it to work. &lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Sean&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Oct 2015 19:52:53 GMT</pubDate>
    <dc:creator>SeanConlon</dc:creator>
    <dc:date>2015-10-13T19:52:53Z</dc:date>
    <item>
      <title>Using Python to Export all MXD's in a Directory</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/using-python-to-export-all-mxd-s-in-a-directory/m-p/577299#M7864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I was just wondering if anyone knew how I could use Python to open and export all *.mxd documents in a directory (as a pdf). At the moment I can open specific *.mxd documents and export them. If I could have a code however that looks in a directory and could open all the files within it and export all the maps it would save me a lot of time.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 24 Feb 2013 10:49:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/using-python-to-export-all-mxd-s-in-a-directory/m-p/577299#M7864</guid>
      <dc:creator>JamesHockey</dc:creator>
      <dc:date>2013-02-24T10:49:13Z</dc:date>
    </item>
    <item>
      <title>Re: Using Python to Export all MXD's in a Directory</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/using-python-to-export-all-mxd-s-in-a-directory/m-p/577300#M7865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try using model builder and one of the iterate functions to list and iterate MXD files in a workspace / directory and export to PDF.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you have subfolders have a look into the arcpy Walk function to do recursive searches for MXD files.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Craig&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2013 20:01:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/using-python-to-export-all-mxd-s-in-a-directory/m-p/577300#M7865</guid>
      <dc:creator>CPoynter</dc:creator>
      <dc:date>2013-02-25T20:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using Python to Export all MXD's in a Directory</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/using-python-to-export-all-mxd-s-in-a-directory/m-p/577301#M7866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ModelBuilder will work, but if you want to do it in Python, like your post says, all you need is something like this that loops through all MXDs in a folder, then exports them to PDF.&lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os
folderPath = r"C:\Project"
for filename in os.listdir(folderPath):
&amp;nbsp;&amp;nbsp;&amp;nbsp; fullpath = os.path.join(folderPath, filename)
&amp;nbsp;&amp;nbsp;&amp;nbsp; if os.path.isfile(fullpath):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; basename, extension = os.path.splitext(fullpath)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if extension.lower() == ".mxd":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument(fullpath)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToPDF(mxd, basename + '.pdf')&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:50:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/using-python-to-export-all-mxd-s-in-a-directory/m-p/577301#M7866</guid>
      <dc:creator>JeffMoulds</dc:creator>
      <dc:date>2021-12-12T00:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using Python to Export all MXD's in a Directory</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/using-python-to-export-all-mxd-s-in-a-directory/m-p/577302#M7867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jeff,&amp;nbsp; this works almost perfectly. In testing, it created PDF's out all my MXD's in a folder,&amp;nbsp; but is it possible to output to a &lt;SPAN style="text-decoration: underline;"&gt;&lt;EM&gt;different&lt;/EM&gt; &lt;/SPAN&gt;folder?&amp;nbsp; I tried messing around with your code but I don't have enough knowledge to get it to work. &lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Sean&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Oct 2015 19:52:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/using-python-to-export-all-mxd-s-in-a-directory/m-p/577302#M7867</guid>
      <dc:creator>SeanConlon</dc:creator>
      <dc:date>2015-10-13T19:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Using Python to Export all MXD's in a Directory</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/using-python-to-export-all-mxd-s-in-a-directory/m-p/577303#M7868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sean,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy, os&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;folderPath = r"C:\Project"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;outFolder = r"C:\Project\PDFs" ## create an output folder&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for filename in os.listdir(folderPath):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    fullpath = os.path.join(folderPath, filename)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    if os.path.isfile(fullpath):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        basename, extension = os.path.splitext(fullpath)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        if extension.lower() == ".mxd":&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            mxd = arcpy.mapping.MapDocument(fullpath)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            arcpy.mapping.ExportToPDF(mxd, outFolder + basename + '.pdf')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will probably need to create ‘PDFs’ folder before running script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Craig&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C. Poynter&lt;/P&gt;&lt;P&gt;Information Technology Officer (Spatial Analysis) | Research Office, Spatial Data Analysis Network (SPAN)&lt;/P&gt;&lt;P&gt;Charles Sturt University&lt;/P&gt;&lt;P&gt;Boorooma Street&lt;/P&gt;&lt;P&gt;Wagga Wagga, NSW, 2678&lt;/P&gt;&lt;P&gt;Australia&lt;/P&gt;&lt;P&gt;Phone: +61 2 69332165&lt;/P&gt;&lt;P&gt;Fax: +61 2 69332735&lt;/P&gt;&lt;P&gt;Email: cpoynter@csu.edu.au&amp;lt;mailto:cpoynter@csu.edu.au&amp;gt;&lt;/P&gt;&lt;P&gt;www.csu.edu.au&amp;lt;http://www.csu.edu.au/&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Oct 2015 21:17:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/using-python-to-export-all-mxd-s-in-a-directory/m-p/577303#M7868</guid>
      <dc:creator>CPoynter</dc:creator>
      <dc:date>2015-10-13T21:17:06Z</dc:date>
    </item>
  </channel>
</rss>

