Can I use modelbuilder to locate shapefiles in a folder?

718
4
04-01-2020 09:22 PM
JustinOdell
Occasional Contributor III

Is it possible to create a model that searches through an input folder to locate shapefiles meeting a specific criteria, then output the result? How might this be best achieved?

0 Kudos
4 Replies
DanPatterson_Retired
MVP Emeritus

If you can find a tool in the Toolboxes, it can be used in a model, otherwise, python scripting.

Walk—Data Access module | Documentation for traversing folders and locating featureclasses would be a start

0 Kudos
curtvprice
MVP Esteemed Contributor

It would be helpful to know what criteria and why.

If the shapefiles are all in one folder, the Calculate Value tool with a python function that uses arcpy.ListFeatureClasses() would do it. Less complicated than arcpy.da.Walk.

In pure ModelBuilder, you could use Iterate Feature Classes in a submodel that returns a multivalue with the list.

0 Kudos
JonathanCarruthers-Jones
New Contributor II

I have tried this  solution (see my post of 29/4/20) but cannot get it to work either as it outputs only a single file.

Can you give us a bit more detail on how this proposed solution would work in model builder ?

Thanks ! 

0 Kudos
curtvprice
MVP Esteemed Contributor

I think you are doing it right, I found your post and added a test model to this thread:

Sub-model cannot iterate features with same name ?