<?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 When exporting batch attachments from an ArcGIS Online layer, how do I create individual folders per point? in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/when-exporting-batch-attachments-from-an-arcgis/m-p/228392#M11267</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When exporting batch attachments from an ArcGIS Online layer, I use the code from this GeoNet suggestion:&amp;nbsp;&lt;/P&gt;&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&lt;A href="https://support.esri.com/en/technical-article/000017450"&gt;https://support.esri.com/en/technical-article/000017450&lt;/A&gt;&amp;nbsp;. From here, I want to change the code to create individual folders for each point's attachments. Can anyone help me do this? I'm not knowledgeable of ArcPy, but here is the code in the tool created:&lt;/P&gt;&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&lt;/P&gt;&lt;PRE class="" style="color: #4c4c4c; background-color: whitesmoke; font-size: 0.9rem; margin-bottom: 1.55rem; padding: 10px;"&gt;import arcpy from arcpy import da import os  inTable = arcpy.GetParameterAsText(0) fileLocation = arcpy.GetParameterAsText(1)  with da.SearchCursor(inTable, ['DATA', 'ATT_NAME', 'ATTACHMENTID']) as cursor: &amp;nbsp;&amp;nbsp;&amp;nbsp; for item in cursor: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attachment = item[0] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filenum = "ATT" + str(item[2]) + "_" &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filename = filenum + str(item[1]) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; open(fileLocation + os.sep + filename, 'wb').write(attachment.tobytes()) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del item &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del filenum &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del filename &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del attachment&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 Aug 2020 19:23:17 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2020-08-05T19:23:17Z</dc:date>
    <item>
      <title>When exporting batch attachments from an ArcGIS Online layer, how do I create individual folders per point?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/when-exporting-batch-attachments-from-an-arcgis/m-p/228392#M11267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When exporting batch attachments from an ArcGIS Online layer, I use the code from this GeoNet suggestion:&amp;nbsp;&lt;/P&gt;&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&lt;A href="https://support.esri.com/en/technical-article/000017450"&gt;https://support.esri.com/en/technical-article/000017450&lt;/A&gt;&amp;nbsp;. From here, I want to change the code to create individual folders for each point's attachments. Can anyone help me do this? I'm not knowledgeable of ArcPy, but here is the code in the tool created:&lt;/P&gt;&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&lt;/P&gt;&lt;PRE class="" style="color: #4c4c4c; background-color: whitesmoke; font-size: 0.9rem; margin-bottom: 1.55rem; padding: 10px;"&gt;import arcpy from arcpy import da import os  inTable = arcpy.GetParameterAsText(0) fileLocation = arcpy.GetParameterAsText(1)  with da.SearchCursor(inTable, ['DATA', 'ATT_NAME', 'ATTACHMENTID']) as cursor: &amp;nbsp;&amp;nbsp;&amp;nbsp; for item in cursor: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attachment = item[0] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filenum = "ATT" + str(item[2]) + "_" &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filename = filenum + str(item[1]) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; open(fileLocation + os.sep + filename, 'wb').write(attachment.tobytes()) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del item &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del filenum &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del filename &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del attachment&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Aug 2020 19:23:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/when-exporting-batch-attachments-from-an-arcgis/m-p/228392#M11267</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-08-05T19:23:17Z</dc:date>
    </item>
  </channel>
</rss>

