Unable to generate an attachment match table with pictures stored in individual subfolders using python.

711
1
07-11-2017 12:48 PM
MichaelTorbett
Occasional Contributor

Hello,

First off, I'm not very good at python but I need help with the follow code. All I'm trying to do is generate an attachment match table by selecting pictures stored in sub folders. Please note that the snippet below is part of a larger script. When I run it, no errors are generated and everything works fine except for the match table (which gets created, but comes up empty every time). I'm using ArcGIS 10.5. and there is a field in the database table named "RadioCall" that has the same names as the pictures. The field is a 'string.'

# Description: Creates an attachment match table for all files by walking through a set of subfolders

rootFolder = "W:\InventoryPhotos"

for folder in os.walk(rootFolder):
   arcpy.GenerateAttachmentMatchTable_management(Fleetdata, folder[0], Matchtable, "RadioCall", ".jpg", "RELATIVE")

Any help would be appreciated. 

Thanks,

Michael

0 Kudos
1 Reply
AlexanderBrown5
Occasional Contributor II

Michael,

Try using:

"*.jpg"‍‍

Instead of just:

".jpg"‍‍

Here is the updated line:

arcpy.GenerateAttachmentMatchTable_management(Fleetdata, folder[0], Matchtable, "RadioCall", "*.jpg", "RELATIVE")‍‍‍

Also, this thread discusses this tool:

Generate Attachment Match Table - Python script issue 

~Alex

0 Kudos