Is This Content Helpful?
We're glad to know this article was helpful.
There are no geoprocessing tools that allow users to export and save all attachments locally. The instructions provided below describe a possible solution.
The following 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 file.
This script requires the input table to be the standard attachment table created when attachments are enabled on a feature class. This is because the below 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 filenum = "ATT" + str(item) + "_" filename = filenum + str(item) open(fileLocation + os.sep + filename, 'wb').write(attachment.tobytes()) del item del filenum del filename del attachment