mostafa872

help me with this script please.

Discussion created by mostafa872 on Jan 19, 2014
Latest reply on Jan 22, 2014 by lpinner
Hello group,
How can I Find all broken data sources in all map documents in a folder or a hard drive?

I'm trying to use this script but i always recieve an error

import arcpy.mapping as mapping, os
path = r"C:"
f = open('filename_here.txt','w')
for root,dirs,files in os.walk(path):
    for filename in files:
    basename, extension = os.path.splitext(filename)
        if extension == ".mxd":
            fullPath = os.path.join(path,filename)
            mxd = mapping.MapDocument(fullPath)
            f.write("MXD: " + filename + "\n")
            brknList = mapping.ListBrokenDataSources(mxd)
            for brknItem in brknList:
                f.write("\t" + brknItem.name + "\n")
f.close()

so please help me with this.
Thank you.

Outcomes