Using Walk() to navigate directories

In this recipe, you will learn how to generate data names in a catalog tree using the Arcpy Walk() function. Though similar to the Python os.walk() function, the da.Walk() function provides some important enhancements related to geodatabases.

Getting ready

The Walk() function, which is part of arcpy.da, generates data names in a catalog tree by walking the tree top-down or bottom-up. Each directory or workspace yields a tuple containing the directory path, directory names, and filenames. This function is similar to the Python os.walk() function but it has the added advantage of being able to recognize geodatabase structures. The os.walk() function is file-based so it isn't able to tell you information about geodatabase ...

Get Programming ArcGIS with Python Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.