<?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: I want to create a folder using an attribute value from a feature in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/i-want-to-create-a-folder-using-an-attribute-value/m-p/46067#M3699</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks that works perfectly&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 31 Jul 2013 09:28:59 GMT</pubDate>
    <dc:creator>OLANIYANOLAKUNLE</dc:creator>
    <dc:date>2013-07-31T09:28:59Z</dc:date>
    <item>
      <title>I want to create a folder using an attribute value from a feature</title>
      <link>https://community.esri.com/t5/python-questions/i-want-to-create-a-folder-using-an-attribute-value/m-p/46063#M3695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is my code and the error message received also&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;mxd = arcpy.mapping.MapDocument("Current") df = arcpy.mapping.ListDataFrames(mxd)[0] fc = "Parcels" field = "StateName" cursor = arcpy.SearchCursor(fc)&amp;nbsp; for row in cursor:&amp;nbsp; val = row.getValue(field) arcpy.CreateFolder_management("C:\\"+ "\\" + Str(val) + "\\")&amp;nbsp; Runtime error&amp;nbsp; Traceback (most recent call last):&amp;nbsp;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 1, in &amp;lt;module&amp;gt;&amp;nbsp;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 14477, in CreateFolder&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e ExecuteError: Failed to execute. Parameters are not valid. ERROR 000735: Folder Name: Value is required Failed to execute (CreateFolder).&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jul 2013 11:34:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-want-to-create-a-folder-using-an-attribute-value/m-p/46063#M3695</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2013-07-30T11:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: I want to create a folder using an attribute value from a feature</title>
      <link>https://community.esri.com/t5/python-questions/i-want-to-create-a-folder-using-an-attribute-value/m-p/46064#M3696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Str shouldn't be capitalized. Also string substitution would be the preferred method for these kinds of operations, which eliminates the need for the str operator at all.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;arcpy.CreateFolder_management("C:\\{0}".format(val)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The way I create folders is using os.makedirs(). This creates all directories recursively if they do not exist which helps if you want to create folders where the parent folders may or may not exist.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jul 2013 12:08:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-want-to-create-a-folder-using-an-attribute-value/m-p/46064#M3696</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2013-07-30T12:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: I want to create a folder using an attribute value from a feature</title>
      <link>https://community.esri.com/t5/python-questions/i-want-to-create-a-folder-using-an-attribute-value/m-p/46065#M3697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I still have the same error check it below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; mxd = arcpy.mapping.MapDocument("Current")
&amp;gt;&amp;gt;&amp;gt; df = arcpy.mapping.ListDataFrames(mxd)[0]
&amp;gt;&amp;gt;&amp;gt; fc = "Parcels"
&amp;gt;&amp;gt;&amp;gt; field = "StateName"
&amp;gt;&amp;gt;&amp;gt; cursor = arcpy.SearchCursor(fc)
&amp;gt;&amp;gt;&amp;gt; for row in cursor:
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; val = row.getValue(field)
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;gt;&amp;gt;&amp;gt; arcpy.CreateFolder_management("C:\\{0}".format(val))
Runtime error&amp;nbsp; Traceback (most recent call last):&amp;nbsp;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 1, in &amp;lt;module&amp;gt;&amp;nbsp;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 14477, in CreateFolder&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e ExecuteError: Failed to execute. Parameters are not valid. ERROR 000735: Folder Name: Value is required Failed to execute (CreateFolder). &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:48:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-want-to-create-a-folder-using-an-attribute-value/m-p/46065#M3697</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2021-12-10T21:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: I want to create a folder using an attribute value from a feature</title>
      <link>https://community.esri.com/t5/python-questions/i-want-to-create-a-folder-using-an-attribute-value/m-p/46066#M3698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ah that is because that tool requires two parameters, the path and the folder name separate. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;arcpy.CreateFolder_management("C:\\", str(val))&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.1/index.html#//0017000000pz000000" rel="nofollow" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//0017000000pz000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It would be easier to just use os.makedirs()&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jul 2013 12:54:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-want-to-create-a-folder-using-an-attribute-value/m-p/46066#M3698</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2013-07-30T12:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: I want to create a folder using an attribute value from a feature</title>
      <link>https://community.esri.com/t5/python-questions/i-want-to-create-a-folder-using-an-attribute-value/m-p/46067#M3699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks that works perfectly&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 09:28:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-want-to-create-a-folder-using-an-attribute-value/m-p/46067#M3699</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2013-07-31T09:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: I want to create a folder using an attribute value from a feature</title>
      <link>https://community.esri.com/t5/python-questions/i-want-to-create-a-folder-using-an-attribute-value/m-p/46068#M3700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Please can you help me with this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to create the following Nested folders i.e.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; - StateName - arcpy.CreateFolder_management("C:\\", str(val))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; - LGAName(DistrictName) this would be created inside the StateName Folder - arcpy.CreateFolder_management("C:\\", str(val),outName)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; - PlotNo(BlockNo) this would be created inside the LGAName(DistrictName) Folder - arcpy.CreateFolder_management("C:\\", str(val)+ outName,outName1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; - arcpy.mapping.ExportToPDF(mxd,r"C:\\", str(val) + outName + "\\" + outName1 + "\\" + "Land Granted To " + outName2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm having this "cant take more than two arguments issue especially with the last two create folder statements and the export to pdf statement&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;this was the script I used below&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;fc = "Parcels"
field = "OBJECTID"
field1 = "Plot_No"
field2 = "Block_No"
field3 = "Name_Allottee"
field4 = "TDP_Status"
field5 = "LGA"
field6 = "District"
field7 = "Shape.STLength()"
field8 = "SitePlan_Status"
cursor = arcpy.SearchCursor(fc)
for row in cursor:
#row.getValue(field)
&amp;nbsp;&amp;nbsp; val = row.getValue(field)
&amp;nbsp;&amp;nbsp; val1 = row.getValue(field1)
&amp;nbsp;&amp;nbsp; val2 = row.getValue(field2)
&amp;nbsp;&amp;nbsp; val3 = row.getValue(field3)
&amp;nbsp;&amp;nbsp; val4 = row.getValue(field4)
&amp;nbsp;&amp;nbsp; val5 = row.getValue(field5)
&amp;nbsp;&amp;nbsp; val6 = row.getValue(field6)
&amp;nbsp;&amp;nbsp; val7 = row.getValue(field7)
&amp;nbsp;&amp;nbsp; val8 = row.getValue(field8)

outName = str(val5) + "_LGA" + "(" + str(val6) + "_Area" + ")"
outName1 = "Plot_" + str(val1) + "(" "Block_" + str(val2) + ")"
outName2 = str(val3) + " Block_" + str(val2) + "_Plot_" + str(val1) + "_" + str(val6) + "_Area_of_" + str(val5) + "_LGA" + ".pdf"
arcpy.CreateFolder_management("C:\\", str(val),outName)
arcpy.CreateFolder_management("C:\\", str(val)+ outName,outName1)
arcpy.mapping.ExportToPDF(mxd,r"C:\\", str(val) + outName + "\\" + outName1 + "\\" + "Land Granted To " + outName2)
os.startfile(r"C:\\", str(val) + outName + "\\" + outName1 + "\\" + "Land Granted To " + outName2)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kindly assist please. Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:48:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-want-to-create-a-folder-using-an-attribute-value/m-p/46068#M3700</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2021-12-10T21:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: I want to create a folder using an attribute value from a feature</title>
      <link>https://community.esri.com/t5/python-questions/i-want-to-create-a-folder-using-an-attribute-value/m-p/46069#M3701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;A href="http://docs.python.org/2/library/os.html#os.makedirs"&gt;os.makedirs(your_path)&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Aug 2013 14:52:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-want-to-create-a-folder-using-an-attribute-value/m-p/46069#M3701</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2013-08-01T14:52:58Z</dc:date>
    </item>
  </channel>
</rss>

