<?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: Naming Batch Exports From FGDB in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1102873#M62562</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/125362"&gt;@PaulGardiner&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You can achieve this doing the following workflow:&lt;/P&gt;&lt;P&gt;1. Use the&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-blog/export-attachments-toolbox/ba-p/1022018" target="_blank" rel="noopener"&gt;Export Attachments toolbox&lt;/A&gt; to export the photos to different folders by field value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2. In windows explorer, search for the photos (e.g., "ext: jpg") in the folder containing all the exported folders. You will get a list of all the photos from all the folders.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="UriGilad_EsriAu_1-1632875610580.png" style="width: 690px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/24084iBD00BA4E5087B65C/image-dimensions/690x219?v=v2" width="690" height="219" role="button" title="UriGilad_EsriAu_1-1632875610580.png" alt="UriGilad_EsriAu_1-1632875610580.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3. Select all the photos, cut and paste into one folder&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;4. Delete all the empty folders&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The other replies to your post&amp;nbsp;are using the base script provided by Esri (which is also found in my toolbox as &lt;EM&gt;Export Attachments From Table&lt;/EM&gt;). That script &lt;STRONG&gt;doesn't and can't access the field value&lt;/STRONG&gt; because that value is not stored in the photo attachment table, but only in the parent Feature Class. To access this value the script needs to match each photo's REL_GLOBALID to the parent's feature class GLOBALID, which is what the &lt;A href="https://community.esri.com/t5/arcgis-pro-blog/export-attachments-toolbox/ba-p/1022018" target="_blank" rel="noopener"&gt;Export Attachments toolbox&lt;/A&gt;&amp;nbsp;does.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hope this helps,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Uri&lt;/SPAN&gt;&lt;/P&gt;&lt;H6&gt;&lt;SPAN&gt;If this answer solved your question or if you found it helpful please mark it accordingly to help others who have the same question.&lt;/SPAN&gt;&lt;/H6&gt;</description>
    <pubDate>Wed, 29 Sep 2021 00:35:12 GMT</pubDate>
    <dc:creator>UriGilad_EsriAu</dc:creator>
    <dc:date>2021-09-29T00:35:12Z</dc:date>
    <item>
      <title>Naming Batch Exports From FGDB</title>
      <link>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1102500#M62548</link>
      <description>&lt;P&gt;I am batch exporting photo attachments from a FGDB using the ExportAttachment script (as attached). The FGDB consists of points which have a field called MapID (which contains a unique identified for each point).&lt;/P&gt;&lt;P&gt;Is there script I can add to this so that the exported photo is named as 'FieldValue_PhotoNo'?&lt;/P&gt;&lt;P&gt;I have also used the Export Attachments tool by &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/195424"&gt;@UriGilad_EsriAu&lt;/a&gt;&amp;nbsp;&amp;nbsp;but would rather not have to group the photos by field value if possible (so the output consists of a single folder containing all photos rather than multiple folders).&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 11:51:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1102500#M62548</guid>
      <dc:creator>PaulGardiner</dc:creator>
      <dc:date>2021-09-28T11:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: Naming Batch Exports From FGDB</title>
      <link>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1102511#M62549</link>
      <description>&lt;P&gt;Have you modified the cursor to take your fields? The name will be derived from a concatenation of row[0] and row[1].&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 12:29:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1102511#M62549</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-09-28T12:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: Naming Batch Exports From FGDB</title>
      <link>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1102558#M62550</link>
      <description>&lt;P&gt;Apologies, Python scripting is not a forte of mine. Would appreciate it if you could expand a little bit on the above. Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 14:11:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1102558#M62550</guid>
      <dc:creator>PaulGardiner</dc:creator>
      <dc:date>2021-09-28T14:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: Naming Batch Exports From FGDB</title>
      <link>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1102575#M62551</link>
      <description>&lt;P&gt;I think it may just be an easy change of the fields specified in the cursor (part of the script), but I'm not completely sure of your field names and the output name, is it based on MapID or fieldValue_photoNumber?&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
from arcpy import da
import os

inTable = arcpy.GetParameterAsText(0)
fileLocation = arcpy.GetParameterAsText(1)

#data, attname and attachmentid will need to be changed to your relevant fields

with da.SearchCursor(inTable, ['DATA', 'ATT_NAME', 'ATTACHMENTID']) as cursor:
    for item in cursor:
        attachment = item[0]
        filenum = "ATT" + str(item[2]) + "_"
        filename = filenum + str(item[1])
        open(fileLocation + os.sep + filename, 'wb').write(attachment.tobytes())
        del item
        del filenum
        del filename
        del attachment&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 14:36:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1102575#M62551</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-09-28T14:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: Naming Batch Exports From FGDB</title>
      <link>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1102580#M62553</link>
      <description>&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-blog/export-attachments-toolbox/ba-p/1022018" target="_blank" rel="noopener"&gt;Export Attachments Toolbox - Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I don't see where it would be making multiple folders. There should only be the one&amp;nbsp;fileLocation folder with all the attachments. I altered the code slightly for ArcGIS Pro to make it easier for you to change the file name. Could you give a specific example of how you want the output files to be named and organized?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
import os

in_table = arcpy.GetParameterAsText(0)
out_dir = arcpy.GetParameterAsText(1)

with arcpy.da.SearchCursor(in_table, ['DATA', 'ATT_NAME', 'ATTACHMENTID']) as cursor:
    for data, att_name, attachmentid in cursor:
        file_name = f"ATT{attachmentid}_{att_name}"
        file_path = os.path.join(out_dir, file_name)
        open(file_path, 'wb').write(data.tobytes())&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 21:34:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1102580#M62553</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-09-28T21:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: Naming Batch Exports From FGDB</title>
      <link>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1102701#M62558</link>
      <description>&lt;P&gt;I do something similar to this.&amp;nbsp; Since I have a relationship defined between the attachment table and the feature class, there is a field in the attachment table that holds the GUID of the associated feature. So my script reads this field in (along with&amp;nbsp;'DATA', 'ATT_NAME', 'ATTACHMENTID') then looks up the feature to get the desired value ('MapID') in your case.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 17:52:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1102701#M62558</guid>
      <dc:creator>DonMorrison1</dc:creator>
      <dc:date>2021-09-28T17:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: Naming Batch Exports From FGDB</title>
      <link>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1102873#M62562</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/125362"&gt;@PaulGardiner&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You can achieve this doing the following workflow:&lt;/P&gt;&lt;P&gt;1. Use the&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-blog/export-attachments-toolbox/ba-p/1022018" target="_blank" rel="noopener"&gt;Export Attachments toolbox&lt;/A&gt; to export the photos to different folders by field value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2. In windows explorer, search for the photos (e.g., "ext: jpg") in the folder containing all the exported folders. You will get a list of all the photos from all the folders.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="UriGilad_EsriAu_1-1632875610580.png" style="width: 690px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/24084iBD00BA4E5087B65C/image-dimensions/690x219?v=v2" width="690" height="219" role="button" title="UriGilad_EsriAu_1-1632875610580.png" alt="UriGilad_EsriAu_1-1632875610580.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3. Select all the photos, cut and paste into one folder&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;4. Delete all the empty folders&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The other replies to your post&amp;nbsp;are using the base script provided by Esri (which is also found in my toolbox as &lt;EM&gt;Export Attachments From Table&lt;/EM&gt;). That script &lt;STRONG&gt;doesn't and can't access the field value&lt;/STRONG&gt; because that value is not stored in the photo attachment table, but only in the parent Feature Class. To access this value the script needs to match each photo's REL_GLOBALID to the parent's feature class GLOBALID, which is what the &lt;A href="https://community.esri.com/t5/arcgis-pro-blog/export-attachments-toolbox/ba-p/1022018" target="_blank" rel="noopener"&gt;Export Attachments toolbox&lt;/A&gt;&amp;nbsp;does.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hope this helps,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Uri&lt;/SPAN&gt;&lt;/P&gt;&lt;H6&gt;&lt;SPAN&gt;If this answer solved your question or if you found it helpful please mark it accordingly to help others who have the same question.&lt;/SPAN&gt;&lt;/H6&gt;</description>
      <pubDate>Wed, 29 Sep 2021 00:35:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1102873#M62562</guid>
      <dc:creator>UriGilad_EsriAu</dc:creator>
      <dc:date>2021-09-29T00:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: Naming Batch Exports From FGDB</title>
      <link>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1102985#M62563</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/195424"&gt;@UriGilad_EsriAu&lt;/a&gt;&amp;nbsp;, yes that does work but had wanted to automate the entire process from within GIS.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Intention was to join the attribute field I wanted to name the files with to the attachment table using GLOBALID/REL_GLOBALID as the join field.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 08:13:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1102985#M62563</guid>
      <dc:creator>PaulGardiner</dc:creator>
      <dc:date>2021-09-29T08:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: Naming Batch Exports From FGDB</title>
      <link>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1103373#M62567</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/125362"&gt;@PaulGardiner&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;If it's any help, here's a little ArcGIS toolbox that grabs all the photos from the folders, moves them up a level and deletes the folders. The tool input should be the folder where you exported all your photos to.&lt;/P&gt;&lt;P&gt;It'll work only on jpg and png file types. To add more types open the script and add types extension type in 'file_type' parameter.&amp;nbsp;Any folder that had photos in it and remained empty after the export will be deleted.&lt;/P&gt;&lt;P&gt;Cheers,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Uri&lt;/P&gt;&lt;H6&gt;If this answer solved your question or if you found it helpful please mark it accordingly to help others who have the same question.&lt;/H6&gt;</description>
      <pubDate>Thu, 30 Sep 2021 05:46:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1103373#M62567</guid>
      <dc:creator>UriGilad_EsriAu</dc:creator>
      <dc:date>2021-09-30T05:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: Naming Batch Exports From FGDB</title>
      <link>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1103604#M62568</link>
      <description>&lt;P&gt;Thanks all, hoping to get a chance over the coming days to work through your suggestions and will update. Your help, as always, is much appreciated.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 16:27:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1103604#M62568</guid>
      <dc:creator>PaulGardiner</dc:creator>
      <dc:date>2021-09-30T16:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: Naming Batch Exports From FGDB</title>
      <link>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1103607#M62569</link>
      <description>&lt;P&gt;Thanks for that, really appreciated. Will try and put together a workflow with both scripts.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 16:28:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1103607#M62569</guid>
      <dc:creator>PaulGardiner</dc:creator>
      <dc:date>2021-09-30T16:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: Naming Batch Exports From FGDB</title>
      <link>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1107716#M62647</link>
      <description>&lt;P&gt;Hey Paul&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure if you solved your problem but I have a script that does exactly what you are trying to accomplish&lt;/P&gt;&lt;P&gt;Let me know if you have any questions (in my case I had to filtered for start and end dates but you can remove that)&lt;/P&gt;&lt;P&gt;def main():&lt;BR /&gt;import arcpy&lt;BR /&gt;from arcpy import da&lt;BR /&gt;import os&lt;/P&gt;&lt;P&gt;inTable = "Database Connections\\DATABASENAME@DIRECTCONNECT.sde\\coa_working.COA_GIS.Parcels_point_edit_assessor__ATTACH"&lt;BR /&gt;##inTable=arcpy.GetParameterAsText(0)&lt;BR /&gt;fc = "Database Connections\\DATABASENAME@DIRECTCONNECT.sde\\coa_working.COA_GIS.Parcels_point_edit_assessor"&lt;BR /&gt;##fc = arcpy.GetParameterAsText(1)&lt;/P&gt;&lt;P&gt;fldRelatedInfo = 'PARCELID' # should be valid column in FC&lt;BR /&gt;##fldRelatedInfo = arcpy.GetParameterAsText(2)&lt;BR /&gt;fileLocation = "d:\\temp\\assessor\\Attch_input"&lt;BR /&gt;##fileLocation = arcpy.GetParameterAsText(3)&lt;BR /&gt;##print fileLocation&lt;BR /&gt;#dStartDate = arcpy.GetParameterAsText(4)&lt;BR /&gt;dStartDate = '10/01/2019'&lt;BR /&gt;#dEndDate = arcpy.GetParameterAsText(5)&lt;BR /&gt;dEndDate = '03/15/2020'&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;expresDate = "[last_edited_date]&amp;gt;='" + dStartDate + "' and [last_edited_date]&amp;lt;'" +dEndDate + "'"&lt;BR /&gt;print expresDate&lt;/P&gt;&lt;P&gt;##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;&lt;BR /&gt;## ##Sterp 1:&lt;BR /&gt;## ##Query records that are between the selected dates&lt;BR /&gt;## print "Entering FC search records between dates"&lt;BR /&gt;## ##expresDate = "[PicTaken] = 'Yes' and [last_edited_date]&amp;gt;='" + dStartDate + "' and [last_edited_date]&amp;lt;'" +dEndDate + "'"&lt;BR /&gt;## print expresDate&lt;BR /&gt;with da.SearchCursor(fc, ['GlobalID', 'PARCELID'],where_clause=expresDate) as cursor:&lt;BR /&gt;NewRec = []&lt;BR /&gt;multipleVals = {}&lt;BR /&gt;rowcountNewRec = 0&lt;BR /&gt;for item in cursor:&lt;BR /&gt;##Initial counter&lt;BR /&gt;##print item[0]&lt;BR /&gt;tmf = {item[0]:item[1]}&lt;BR /&gt;multipleVals.update(tmf)&lt;BR /&gt;NewRec.append(item[0])&lt;BR /&gt;rowcountNewRec = rowcountNewRec+1&lt;BR /&gt;&lt;BR /&gt;print len(NewRec)&lt;/P&gt;&lt;P&gt;##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;##Sterp 2:&lt;BR /&gt;##Query records from the attached table that matches the previous selection&lt;BR /&gt;print "Entering Attachment Searchcursor"&lt;BR /&gt;##Search from the attachment table&lt;BR /&gt;for itemAttch in multipleVals:&lt;BR /&gt;##print "--------------- " + itemAttch + " ---- " + multipleVals[itemAttch]&lt;BR /&gt;attExpression = arcpy.AddFieldDelimiters(inTable, 'REL_GLOBALID') + " = '{0}'".format(itemAttch)&lt;BR /&gt;print attExpression&lt;BR /&gt;with da.SearchCursor(inTable, ['DATA', 'ATT_NAME', 'ATTACHMENTID', 'REL_GLOBALID'], where_clause=attExpression) as cursor:&lt;BR /&gt;filesNew = []&lt;BR /&gt;rowcount = 1&lt;BR /&gt;for item in cursor:&lt;BR /&gt;##Initial counter&lt;BR /&gt;&lt;BR /&gt;relOID = item[3]&lt;BR /&gt;print relOID&lt;BR /&gt;&lt;BR /&gt;##Check to see if the selected records in the List created from the date range&lt;BR /&gt;if relOID in NewRec:&lt;BR /&gt;print "We found a new picture -- " + relOID&lt;BR /&gt;else:&lt;BR /&gt;print "-- Not relevent"&lt;BR /&gt;&lt;BR /&gt;##print rowcount&lt;BR /&gt;##Check to see if the record already has a picture, if it does find the # and assigned the&lt;BR /&gt;if relOID in filesNew:&lt;BR /&gt;filesNew.append(relOID)&lt;BR /&gt;iCount = filesNew.count(relOID)&lt;BR /&gt;rowcount = iCount&lt;BR /&gt;else:&lt;BR /&gt;rowcount = 1&lt;BR /&gt;filesNew.append(relOID)&lt;BR /&gt;&lt;BR /&gt;# access related information... Choose Geocode or parcelid????&lt;BR /&gt;print "looking for related info"&lt;BR /&gt;##myRelatedInfo = QueryRelatedData(fc, fldRelatedInfo, relOID)&lt;BR /&gt;myRelatedInfo = multipleVals[itemAttch]&lt;BR /&gt;print "****** " +myRelatedInfo&lt;/P&gt;&lt;P&gt;attachment = item[0]&lt;BR /&gt;filename = myRelatedInfo + "-0" + str(rowcount) + ".jpg" ##filenum + str(item[1])&lt;BR /&gt;print filename&lt;/P&gt;&lt;P&gt;##Save JPG in a folder&lt;BR /&gt;open(fileLocation + os.sep + filename, 'wb').write(attachment.tobytes())&lt;BR /&gt;print "File has been created"&lt;/P&gt;&lt;P&gt;del filename&lt;BR /&gt;del attachment&lt;/P&gt;&lt;P&gt;if __name__ == '__main__':&lt;BR /&gt;main()&lt;/P&gt;&lt;P&gt;##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;should return something like this (PARCELID-XX.jpg)&amp;nbsp; XX=number of attachments)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DominicRoberge2_0-1634247643976.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/25235iFFE7DC43011CF884/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DominicRoberge2_0-1634247643976.png" alt="DominicRoberge2_0-1634247643976.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 21:42:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/naming-batch-exports-from-fgdb/m-p/1107716#M62647</guid>
      <dc:creator>DominicRobergeIADOT</dc:creator>
      <dc:date>2021-10-14T21:42:04Z</dc:date>
    </item>
  </channel>
</rss>

