In ArcGIS ModelBuilder, I am trying to iterate over some ascii files (my_ascii.asc) in a folder (c:\my_folder) and converting them from ascii to raster. This works fine if I do it as shown below.

working iterator

however I want to pass some parts of the input folder as a model parameter.

So let's say my input folders are c:\my_folder_2010 and c:\my_folder_2030, i want the year to be a model parameter. If I make the year variable and pass it into the iterator like c:\my_folder_%year% as shown below, it does something weird. Iterator finds the correct files, outputs the correct 'name' ('my_ascii'), but the output ascii remains 'file.asc' instead of 'my_ascii.asc'. Once it enters the 'ascii to raster', it says that it cannot find the 'file.asc', which is correct, because it is called 'my_ascii.asc'.

not working iterator

Why does iterator only works correct for the 'name' part, and not for the 'file.asc'? Any solutions?

I also tried parsing a path into the first data element that goes into the iterator, but that also did not work.

closed as unclear what you're asking by PolyGeo Nov 9 '15 at 23:59

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Did you try giving the parent folder (the folder that contains folders 2030 and 2010 for example) and tick the recursive box? in that case you would not need to parse the path to each subfolder. This depends of course depends on whether all your data sits within the sub-folders of that parent folder, and that they are all organized similarly. (also make sure that the ascii files are not named the same in the different sub-folders – yanes Oct 22 '15 at 16:07
  • Have you investigated using the Parse Path tool? If so, I think you should edit your question to be what happened when you tried that. – PolyGeo Nov 9 '15 at 23:59