Funny this as I've just spent the last few days developing
Python code to do this... Chad's link is definitely the page you need to be looking at and PolyGeo's link to the
walk function is useful too.
I developed 3 scripts: one for trawling the drive space searching for datasets, a second to trawl for MXDs then extract all the layer information and a third to fix broken links (after everything had been moved to a new folder structure).
- You may have 1 or more dataframes to search.
- You may have the same dataset duplicated but different featurelayer names.
- You may have layers with no featurelayer names.
- You may have datasets that are not in any mxds.
- You may have datasets referenced in the MXD but do not exist anymore or inaccessible locations such as document and settings.
- You will almost certainly have crazy names with superscripts or commas which need dealing with in
- I found that the dataset name referenced in the mxd is not necessarily in the same case as what's on the drive so making text matching problematic.
- A raster dataset may be simply an image such as a logo so you need to exclude these from your search.
- When you use the
da.walk function and ask for tables it will return any text file and even asc files for some reason.
You'll need to consider all these scenarios and probably more for your setup.