Geoprocessing with ModelBuilder: Iterate Files

I have blogged a bit before on using new ModelBuilder features added in ArcGIS 10.0 and today I thought to post another typical workflow I’ve been trying to automate.

Today let’s look at the scenario when you have got a folder. There are dozens of other folders within this folder. There various data files are stored within those folders. The data files might have different extensions and they do not follow directly any naming convention. So, your task is to get several specific file types (say, files with .id and .txt extension) from this big folder and then copy those files into two different folders named something like “Folder_id” and “Folder_txt”, respectively.

You could definitely implement this workflow with some DOS commands or bash scripting, but since we are ArcGIS Desktop users, let’s do this by using the out-of-the-box ModelBuilder tools. So, as we know for now, in ArcGIS 10, the new concept – iterators – was introduced. There are quite a few iterators available to us, but for now we will focus just on two of them – Iterate Files and Iterate Multivalue – which will let us solve the problem with going through those file types.

By using the model below user specifies what file extensions shall the model look for. Thereafter, the needed files are copied into created folders whereas their names reflect the extensions user chosen. Quite useful workflow!

Happy iterating!Image

Embedding the submodel within another model (this is something we have to do since you cannot have two iterators within one model).Image

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s