Save ModelBuilder Outputs into a new folder with every run and under new name

531
2
01-26-2023 02:43 AM
Labels (3)
TimothyODoherty
New Contributor II

Hi, 

 

I have a model with a parameter I can change so that I can run it over different polygon inputs. I am wondering if it is possible to change the name of the outputs within the model and the location to which they output depending on the parameter input.

For example, I am working with rivers inside each continent, so for Africa all the outputs would ideally be named "Africa_Rivers" and be within a folder named "Africa", then I could change the input parameter to Asia and all the outputs would be named "Asia_Rivers" and be within a folder named "Asia".

Tags (2)
0 Kudos
2 Replies
ammsgis
New Contributor III

Hi Timothy!
Have you ever used the Parse Path tool in the Model Builder? With this tool you can define directories e names with variables and choose the name what you want. 

curtvprice
MVP Esteemed Contributor

If you create a text variable and mark it as a parameter, you can use the variable name in tool parameter values, for example, Create Workspace (example: %Continent%) and Copy Features (example: %Continent%_Rivers), or any other tool. I recommend avoiding spaces in the variable name to avoid parameter validation checking blowing up on the spaces, for example use Continent_Name or ContinentName not "Continent Name". If the substitution gets complicated you can use Python string syntax or functions with the Calculate Value tool to get the exact text you want derived from your input name variable.

Hope that helps!

0 Kudos