Generate Attachment Match Table (Data Management)

License Level:BasicStandardAdvanced


ArcGIS geoprocessing tool that creates a match table to be used with the Add Attachments and Remove Attachment tools.

Learn more about working with the Attachments geoprocessing tools



GenerateAttachmentMatchTable_management (in_dataset, in_folder, out_match_table, in_key_field, {in_file_filter}, {in_use_relative_paths})
ParameterExplanationData Type

Input dataset that contains records that will have files attached.

Table View

Folder that contains files to attach.


Table that will be generated which contains two columns: MATCHID and FILENAME.


The values in this field will match the names of the files in the input folder. The matching behavior will ignore file extensions, which allows multiple files with various file extensions to match with a single record in the input dataset.

For example, if the input Key Field value is lot5986, a file on disk named lot5986.jpg would match with this record.


This parameter is used to limit the files the tool considers for matching. If the file name does not meet the criteria in the file filter parameter it will not be processed and therefore will not show up in the output match table. Wild cards (*) can be used in this parameter for more flexible filtering options. Multiple semicolon-delimited filters can be used as well.

For example, consider a directory that contains the following files: parcel.tif, parcel.doc, parcel.jpg, houses.jpg, and report.pdf.

To limit the possible matches in this list to .jpg files, use *.jpg.

To limit the possible matches in this list to .pdf and .doc files, use *.pdf; *.doc.

To limit the possible matches in this list to files beginning with parcel, use parcel*.

To limit the possible matches in this list to files that contain the text arc, use *arc*.


Determines if the output match table field FILENAME will contain a full path to the dataset or only the file name.

  • RELATIVEThe output FILENAME field will contain relative paths. This is the default.
  • ABSOLUTEThe output FILENAME field will contain full paths to the data.

Code Sample

GenerateAttachmentMatchTable example (Python window)

The following code snippet demonstrates how to use the GenerateAttachmentMatchTable in the Python window.

import arcpy
                                              "*.jpg; *.pdf",
GenerateAttachmentMatchTable example (stand-alone Python script)

The following stand-alone script demonstrates how to use the GenerateAttachmentMatchTable tool to create a match table that contains matches for only JPG and PDF files.

# Name:
# Description: Creates an attachment match table for all files that contain the string
#             'property' and are of type 'jpg' while looping through multiple folders.

# Import system modules
import arcpy, os

# Set local variables.
rootFolder = 'c:/work/'

for folder in os.walk(rootFolder):
    if folder[0].find('.gdb') == -1: #exclude file geodatabases from the folder list.


This tool does not use any geoprocessing environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: No
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes