My Arcmap 10.7.1 does not recognize .GLOB but I found another solution. Thank you everybody for your help.
import arcpy, os ... import arcpy.mapping as mapping ... layer = mapping.Layer(r"C:\PATH_TO_LAYER FILE") ... for root, dirs, files in os.walk(r"c:\Users\jcook\Desktop\Batch"):#I have folder named Batch on desktop ... for f in files: ... if f.endswith(".mxd"): ... mxd = root + '\' + f ... mxd_doc = mapping.MapDocument(mxd) ... df = mapping.ListDataFrames(mxd_doc)[0] ... mapping.AddLayer(df, layer, "TOP") ... mxd_doc.save()
import arcpy, os
import arcpy.mapping as mapping
layer = mapping.Layer(r"C:\PATH_TO_LAYER FILE")
for root, dirs, files in os.walk(r"c:\Users\jcook\Desktop\Batch"):#I have folder named Batch on desktop
for f in files:
if f.endswith(".mxd"):
mxd = root + '\\' + f
mxd_doc = mapping.MapDocument(mxd)
df = mapping.ListDataFrames(mxd_doc)[0]
mapping.AddLayer(df, layer, "TOP")
mxd_doc.save()