Hi,I have had a few dramas with the mathc table tool. We have a file structure where multiple files per feature id are stored in folders that are named with the feature id. for example feature id a1 has a corresponding folder called a1 with all the relevant attachments stored within. The way around this was to create a custom match table without using the tool. I have included the function below. Hope this is of help.
import csv, os
def matchTable(inFolder, outFolder):
"""Generates a match table for use in the add attachments tool.
Creates the match table required by the add attachments tool based on the
folder structure. The table contains two columns, GUID and PATH. The
GUID identifies which feature to add the attachment too and PATH holds the
full path location to the file to attach. The inFolder is the location of
the file store, the outFolder is the location to store the match table.
"""
# Create the match table and open the csv for writing
match = outFolder + os.sep + "match.csv"
writer = csv.writer(open(match, "wb"), delimiter=",")
# Write the header row
writer.writerow(["GUID","PATH"])
# Iterate through each folder in the OrientFileStore and get GUID from the folder name
# Then list each file in that folder and write into the match table
for dir in os.listdir(inFolder):
GUID = "{" + (os.path.basename(dir)).upper() + "}"
workspace = inFolder + os.sep + dir
for file in os.listdir(workspace):
PATH = os.path.join(workspace, file)
writer.writerow([GUID,PATH])
del writer
return match
example of a folder structure this works onTop|--SubFolder1 - File1,File2,File3--SubFolder2- File1,File2,File3Where the SubFolder name is a value within the feature class attributes that you will use to add the attachmentsHope this helps Dave