Is This Content Helpful?
How can we make this better? Please provide as much detail as possible.
Contact our Support Team
There are no geoprocessing tools that allow users to export and save all attachments locally. The instructions provided below describe how to execute a possible solution by creating a script tool to accomplish the task.
To batch export attachments from a feature class, create a script tool from a Python script using the workflow provided below, and run the created script tool.
Note: This script requires that the input table be the standard attachment table created when attachments are enabled on a feature class. This is because the script relies on the DATA, ATT_NAME and ATTACHMENTID fields stored in this table. The typical naming convention should append _ATTACH to the end of the table name.
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: 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
Note: This script iterates through the entire attachment table of a single feature class and copies all of the attachments (saved as BLOBs, or binary large objects) to a file.
Last Published: 10/1/2020
Article ID: 000011912
Software: ArcMap 10.8.1, 10.8, 10.7.1, 10.7, 10.6.1, 10.6, 10.5.1, 10.5, 10.4.1, 10.4, 10.3.1, 10.3, 10.2.2, 10.2.1, 10.2, 10.1, 10