<?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 How to change output directory? in Mapping Questions</title>
    <link>https://community.esri.com/t5/mapping-questions/how-to-change-output-directory/m-p/297528#M3094</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So I've got this great, simple loop running thanks to a member here. I set the workspace, pass in the array of files to be processed, run my tool, and append a descriptor to the filename. However this is all done in the same workspace. Is there a way to change the output directory to a different location while keeping my input workspace? The script is below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;from arcpy import env&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#where we're working&lt;/P&gt;&lt;P&gt;env.workspace = r"D:\Broomfield.Lidar\HARN_Vertices.gdb"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#array of files to be processed&lt;/P&gt;&lt;P&gt;fc = ['D:\\Broomfield.Lidar\\HARN_Vertices.gdb\\VertexN2W187North', 'D:\\Broomfield.Lidar\\HARN_Vertices.gdb\\VertexN2W188', 'D:\\Broomfield.Lidar\\HARN_Vertices.gdb\\VertexN3E180', 'D:\\Broomfield.Lidar\\HARN_Vertices.gdb\\VertexN3E190', 'D:\\Broomfield.Lidar\\HARN_Vertices.gdb\\VertexN3E191']&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vertices = arcpy.ListFeatureClasses()&lt;/P&gt;&lt;P&gt;print vertices&lt;/P&gt;&lt;P&gt;for fc in vertices:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MinimumBoundingGeometry_management(fc, fc + "_Poly", "RECTANGLE_BY_AREA", "ALL", "", "NO_MBG_FIELDS")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 26 Mar 2015 17:34:09 GMT</pubDate>
    <dc:creator>alexbullen</dc:creator>
    <dc:date>2015-03-26T17:34:09Z</dc:date>
    <item>
      <title>How to change output directory?</title>
      <link>https://community.esri.com/t5/mapping-questions/how-to-change-output-directory/m-p/297528#M3094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So I've got this great, simple loop running thanks to a member here. I set the workspace, pass in the array of files to be processed, run my tool, and append a descriptor to the filename. However this is all done in the same workspace. Is there a way to change the output directory to a different location while keeping my input workspace? The script is below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;from arcpy import env&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#where we're working&lt;/P&gt;&lt;P&gt;env.workspace = r"D:\Broomfield.Lidar\HARN_Vertices.gdb"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#array of files to be processed&lt;/P&gt;&lt;P&gt;fc = ['D:\\Broomfield.Lidar\\HARN_Vertices.gdb\\VertexN2W187North', 'D:\\Broomfield.Lidar\\HARN_Vertices.gdb\\VertexN2W188', 'D:\\Broomfield.Lidar\\HARN_Vertices.gdb\\VertexN3E180', 'D:\\Broomfield.Lidar\\HARN_Vertices.gdb\\VertexN3E190', 'D:\\Broomfield.Lidar\\HARN_Vertices.gdb\\VertexN3E191']&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vertices = arcpy.ListFeatureClasses()&lt;/P&gt;&lt;P&gt;print vertices&lt;/P&gt;&lt;P&gt;for fc in vertices:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MinimumBoundingGeometry_management(fc, fc + "_Poly", "RECTANGLE_BY_AREA", "ALL", "", "NO_MBG_FIELDS")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Mar 2015 17:34:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/how-to-change-output-directory/m-p/297528#M3094</guid>
      <dc:creator>alexbullen</dc:creator>
      <dc:date>2015-03-26T17:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to change output directory?</title>
      <link>https://community.esri.com/t5/mapping-questions/how-to-change-output-directory/m-p/297529#M3095</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;get the list of files first, then set the workspace...I am confused as to why you set the environment, then provide a list o files which I presume are in your gdb, then process the files.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Mar 2015 18:12:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/how-to-change-output-directory/m-p/297529#M3095</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-03-26T18:12:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to change output directory?</title>
      <link>https://community.esri.com/t5/mapping-questions/how-to-change-output-directory/m-p/297530#M3096</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The way it is now, you've listed some feature classes in the variable '&lt;STRONG&gt;fc&lt;/STRONG&gt;', listed some feature classes in your workspace into the variable '&lt;STRONG&gt;vertices&lt;/STRONG&gt;', destroyed the '&lt;STRONG&gt;fc&lt;/STRONG&gt;' list, and are looping through everything in '&lt;STRONG&gt;vertices&lt;/STRONG&gt;' in a new variable called '&lt;STRONG&gt;fc&lt;/STRONG&gt;'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you may want:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os

#array of files to be processed
fcs = ['D:\\Broomfield.Lidar\\HARN_Vertices.gdb\\VertexN2W187North', 'D:\\Broomfield.Lidar\\HARN_Vertices.gdb\\VertexN2W188', 'D:\\Broomfield.Lidar\\HARN_Vertices.gdb\\VertexN3E180', 'D:\\Broomfield.Lidar\\HARN_Vertices.gdb\\VertexN3E190', 'D:\\Broomfield.Lidar\\HARN_Vertices.gdb\\VertexN3E191']

outputFolder = r'C:\junk' # or whatever you choose

for fc in fcs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcName = os.path.basename(fc) # returns '&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;VertexN2W187North&lt;/SPAN&gt;', etc.
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MinimumBoundingGeometry_management(fcName, os.path.join(outputFolder, fcName + "_Poly"), "RECTANGLE_BY_AREA", "ALL", "", "NO_MBG_FIELDS")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:16:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/how-to-change-output-directory/m-p/297530#M3096</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-11T14:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to change output directory?</title>
      <link>https://community.esri.com/t5/mapping-questions/how-to-change-output-directory/m-p/297531#M3097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'll give these os.path functions a try - still pretty new to scripting as you can probably tell. My odd setup comes changing from using a simple ListFeatureClasses (to get all the features) to only wanting certain features to be processed, hence the array. From there I just messed with the variables until the script worked, haha.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Mar 2015 19:23:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/how-to-change-output-directory/m-p/297531#M3097</guid>
      <dc:creator>alexbullen</dc:creator>
      <dc:date>2015-03-26T19:23:56Z</dc:date>
    </item>
  </channel>
</rss>

