ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Iterate Files

  • Summary
  • Usage
  • Syntax
  • Environments
  • Licensing information

Summary

Iterates over files in a folder.

Learn how Iterate Files works in ModelBuilder

Usage

  • This tool is intended for use in ModelBuilder and not in Python scripting.

  • The File Extension option allows you to iterate over files with a particular extension. For example, if you only want files with the extension of .log to be iterated, set the File Extension parameter to log.

  • If the file appears as a dataset in the Catalog window, then Iterate Files will skip the file. The most common examples are shape files, .dbf files, raster files (.jpg, .tif, .img, .png, and .bmp), CAD files (.dxf and .dwg), map files (.mxd), and personal geodatabases (.mdb).

  • The tool has two outputs: Output File and Name which could be used as an in-line variable (for example, %Name%) in other tools.

  • Specify the file extension in the optional parameter for extensions, such as .txt, .pdf, .zip, and so on. For example, if the tool iterates over text files and the output is used in tools, such as ASCII To Raster tool, specify the extension .txt in the optional file extension parameter.

  • Most tools honor the output file format from the Iterate Files tool except tools such as Copy, which requires you to define the file extension in the output name. For example, If you are using the Iterate Files tool to iterate .zip files for use as input to the Copy tool, the output name must contain the extension Name.zip or %Name%.zip.

  • If an Iterator is added to a model, all tools in the model iterate for each value in the iterator. If you do not want to run each tool in the model for each iterated value, create a sub-model/model within a model/nested model that contains only the iterator and add it as a model tool into the main model.

Syntax

arcpy.mb.IterateFiles(in_folder, {wildcard}, {extension}, {recursive})
ParameterExplanationData Type
in_folder

Folder in which the input files are located.

Folder
wildcard
(Optional)

Combination of * and characters that help to limit the results. The asterisk is the same as saying ALL. If no wildcard is specified, all inputs will be returned. For example, it can be used to restrict Iteration over input names starting with a certain character or word (e.g., A* or Ari* or Land*,and so on).

String
extension
(Optional)

The file extension, such as TXT, ZIP, and so on. Only files with the extension will be iterated. Do not use a period before the file extension.

String
recursive
(Optional)

Determines if all subfolders of the main folder will be recursively iterated through.

  • Checked—Will iterate through all subfolders.
  • Unchecked—Will not iterate through all subfolders.
Boolean

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics

  • An overview of the Iterator toolset
  • A quick tour of using iterators

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2021 Esri. | Privacy | Legal