import os, arcpy, sys from arcpy import env env.overwriteOutput = True mxd_match = ".mxd" for root, dirs, files in os.walk(r"C:\temp\python"): fListLength = len(files) if (fListLength != 0): n = 0 for f in files: if f.endswith(mxd_match): full_path = root + "\\" + str(f) try: mxd = arcpy.mapping.MapDocument(full_path) broken = arcpy.mapping.ListBrokenDataSources(mxd) for n in broken: for lyr in arcpy.mapping.ListLayers(mxd, n): if '.sde' not in lyr.dataSource: if '.gdb' not in lyr.dataSource: if '.shp' not in lyr.dataSource: print "SDE broken data source is " + lyr.name del mxd except: print arcpy.GetMessages(2)
import os, arcpy, sys from arcpy import env env.overwriteOutput = True mxd_match = ".mxd" for root, dirs, files in os.walk(arcpy.GetParameterAsText(0)): fListLength = len(files) if (fListLength != 0): n = 0 for f in files: if f.endswith(mxd_match): full_path = root + "\\" + str(f) try: mxd = arcpy.mapping.MapDocument(full_path) broken = arcpy.mapping.ListBrokenDataSources(mxd) for n in broken: for lyr in arcpy.mapping.ListLayers(mxd, n): arcpy.AddMessage("The broken SDE layer dataSource is " + lyr.dataSource) del mxd except: print arcpy.GetMessages(2)
import arcpy from arcpy import env env.overwriteOutput = True mxd = arcpy.mapping.MapDocument("C:\TEMP\python\Airports.mxd") broken = arcpy.mapping.ListBrokenDataSources(mxd) for n in broken: for lyr in arcpy.mapping.ListLayers(mxd, n): print lyr.dataSource del mxd
mxd = arcpy.mapping.MapDocument("C:\TEMP\python\Airports.mxd") broken = arcpy.mapping.ListBrokenDataSources(mxd) for n in broken: for lyr in arcpy.mapping.ListLayers(mxd, n): if '.sde' in lyr.dataSource: print lyr.name del mxd
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.