Recursively List Data Using arcpy.da.walk

Although the ArcGIS Python package arcpy does include the capabilty to list a huge variety of data objects, if the data is contained in nested directories or feature datasets within the geodatabase, creating the nested listing loops to find all the resources can be annoying at best and infuriating at worst. Further, recursive listing loops are not the fastest creatures on earth.

Fortunately, starting with ArcGIS 10.0, a new module was included, the Data Access module. This module, in addition to adding some incredibly useful functionality is screaming fast due to being built using the NumPy module.

Relevant to the topic of listing datasets, the Data Access module includes an extremely useful function for recursively walking down into a directory tree and into geodatabases, the Walk function (arcpy.da.Walk).

Typically used in conjunction with Describe, when used together, this can be a powerful combination for processing data based on properties of the data. The script below, while simple, demonstrates these two working together.