I want to loop many mxds within a folder to retrieve layer,connection,etc. information using python.
I just need the syntax for looping through the mxds.
Search through geonet threads for Walk function in python. You can also search outside geonet for python and walk.
Looks like I need the arcpy.da.Walk and not the os.walk which doesn't return database related features.
Still working on it though.
If you are interested in the innards of the mxd, many recommend ... https://www.arcgis.com/home/item.html?id=f0ae73e90c1a4992a1059e7d370966d4 X-ray
Thank you for the advice. I have been using X-ray, but it doesn't quite fit my purpose. I need the mxd info written to a excel sheet to be used as a ArcGIS table.
Also, the most import need is to loop which X-ray is used on the currently opened mxd.
What kind of database related features are you looking for?
I have the following since I am not sure whether os.walk limitation apples to me since I want to get feature classes information within mxds.
import arcpy, os
workspace = ' xxxxxx '
for root, dirs, files in os.walk(workspace):
for f in files:
if f.endswith(".mxd"):
mxd = root + '\\' + f
print f
I get a list of mxds which is the first successful step but I need the feature classes.
FeatureClasess with info of their respective dataset.
You'll need to get the DataFrames in your mxd
arcpy.mapping.ListDataFrames("name of mxd")
then you'll need to get the layers in each data frame
arcpy.mapping.ListLayers("name of mxd, "", "name of data frame")
Can I input the workspace for listdataframes & listlayers since I want info on 19 mxds, not just one ?