Iterate Files (ModelBuilder)

Summary

Iterates over files in a folder.

Learn how Iterate Files works in ModelBuilder

Usage

  • This tool is only available from ModelBuilder for use in models. The tool is not available from the Geoprocessing pane or from Python.

  • The File Type parameter allows you to iterate over files with a particular extension. For example, if you only want files with the .log extension to be iterated, specify log as the FileType parameter value.

  • If the file appears as a dataset in the Catalog pane, the tool 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) and map files (.mxd, .aprx).

  • The tool has two outputs: File and Name that can be used as an inline 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 the ASCII To Raster tool, specify txt.

  • Most tools honor the output file format from the this 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 this 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.

Parameters

LabelExplanationData Type
Folder

The folder where the input files are located.

Folder
Wildcard
(Optional)

A combination of * and characters that help to limit the results. The asterisk is the same as specifying ALL. If no wildcard is specified, all inputs will be returned. You can use this parameter to restrict iteration over input names starting with a certain character or word (for example, A* or Ari* or Land* and so on).

String
File Type
(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)

Specifies whether all subfolders of the main folder will be recursively iterated.

  • Checked—All subfolders will be recursively iterated.
  • Unchecked—All subfolders will not be recursively iterated.
Boolean

Derived Output

LabelExplanationData Type
File

The full path to the file.

File
Name

The name of the dataset.

String

Environments

This tool does not use any geoprocessing environments.

Licensing information

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

Related topics