AnsweredAssumed Answered

Iterate Field and search folder

Question asked by peterverst on Oct 1, 2018
Latest reply on Oct 1, 2018 by peterverst


I have a point feature with a field containing names of 3D models (tree1).  In a folder with subfolders i have the 3D models (c:\models\tree1.p3d).

I need to find the full path of every 3D model in my feature and put it in a new field (ModelFullPath = c:\models\tree1.p3d)

I have the script to iterate the fields and the script to search the folders but i am having a hard time combining the two.

import arcpy

fc = 'C:/feature.shp'
fields = ['ModelName']

with arcpy.da.SearchCursor(fc, fields) as cursor:
    for row in cursor:


import os
import arcpy

name = "tree1"

for root, dirs, files in os.walk("C:\models"):
    for file in files:
        if file.endswith(name +".p3d"):
             print(os.path.join(root, file))