Merging shapefiles with a column of file names as final feature class

06-27-2019 09:28 AM
New Contributor


I have a set of over 100 individual polygon shape files that I wish to combine (merge) into a a single feature class, with a final column field in my feature class table showing the name of each shape file. For example, for a shape file called "04024000.shp",  I would like a column field called "GISfilename", with the attribute for this specific feature as "04024000".


I have tried utilizing the parse path function in model builder with limited success, although I am looking for any methodology to help. I am a beginner GIS user, so please be clear and basic with your instructions.

I have attached a zip of all the files I wish to combine for your reference.

Thanks in advance,



0 Kudos
1 Reply
Esri Notable Contributor

You can try to use the Workspace iterator to iterate through all shapefiles. This gives you two variables, the name and actual feature class object:

Then use Add Field to add the "GISfilename" field to each shapefile and Calculate Field to calculate the Name value within the new field using inline variable substitution:

The Calculate Field will bring in the %Name% variable when it runs:

After all that's done, you can use the Merge or Append tools to combine all datasets. You can either run Append at the end, or you need to create a separate model to embed the one with your iterator.