AnsweredAssumed Answered

Using Recursive Iterator outputs as Inputs to Tools

Question asked by BahamutZ on Jul 11, 2012
Latest reply on Jul 13, 2012 by BahamutZ
I couldnt get two iterators to work through modelbuilder, so I am trying Python.

Being a total newbie to Python, I was able to set up a loop that gets each shapefile in multiple directories using a wildcard (it is printing each shapefile with print command), but I don't know where to go from here.  I want to be able to use each shapefile to be used as an input feature.  And then going to do the same thing for other shapefiles based on a different wildcard and for the second tool input (e.g clip, erase, identify feature).  How will I go about passing along each file during the loop for the input feature and the other feature at concurrent times? eg. first returned shapefile in one loop will be input feature and first returned shapefile in second loop will be..say an erase feature

Anyways, for a first step, I was just testing the Buffer tool to see if one recursive loop would work, but it doesn't like file as the input parameter. Clearly that must be the wrong parameter.  What do I need to do here?  

import arcpy, os, fnmatch #for wildcards from arcpy import env  rootDir = r"FILEPATH_IS_HERE"  for dirPath, dirNames, fileNames in os.walk(rootDir):#, topdown=False):     for file in fileNames:       if fnmatch.fnmatch(file, "*100110.shp")== True:             print os.path.join(dirPath, file)             env.workspace = os.path.join(dirPath, file)             arcpy.Buffer_analysis(file, r"FILEPATHGOESHERE", 1000)    else:     print "No other matching 100110's"

Thanks for any help.