I tried to add several layer files to MXD file. when i run this code no error rise- but only one layer file added to the MXD and all the other 34 layer files in the workspace aren't added to the map. This is the table of content after runnig the code:
import arcpy,os
workspace = r"G:\desktop\Project\lyr\taba\7650"
mxd = arcpy.mapping.MapDocument(r"G:\desktop\Project\Project.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "*")[0]
walk = arcpy.da.Walk(workspace, datatype="FeatureClass")
for dirpath, dirnames, filenames in walk:
for filename in filenames:
arcpy.mapping.AddLayer(df, arcpy.mapping.Layer(os.path.join(dirpath, filename)))
mxd.save()
How can i add the layers to the Mxd?
i red
filenames:arcpy.mapping
.