Finding all broken data sources in all map documents in a folder
A common scenario in many organizations involves the movement of data from one workspace to another or from one workspace type to another. When this happens, any map documents or layers that reference these data sources become broken. Finding each of these data sources can be a huge task if undertaken manually. Fortunately, you can create a geoprocessing script that will find all broken data sources in a folder or list of folders.
Getting ready
In this recipe, you will learn how to recursively search directories for map document files, find any broken data sources within those map documents, and write the names of the broken data layers to a file.
How to do it...
Follow these steps to learn how to find all broken data sources in all map documents in a folder:
Open IDLE and create a new script window.
Import the
arcpy
andos
packages:import arcpy.mapping as mapping, os
Define a path where you'd like to begin the search. In this case...