I've got some problems with the following code, found on this answer to Auto-updating symbology between *.mxds for same shapefile using arcgisscripting?:
import arcpy.mapping as mmap mxd = mmap.MapDocument("C:/Users/enclume/Carto/Cartes/UpdateTest/P_5_1.mxd") DF = mmap.ListDataFrames(mxd, "Couches") sourcely = mmap.Layer("C:/Users/enclume/Carto/Cartes/Templates/Couches.lyr") ly = mmap.ListLayers(mxd) mmap.UpdateLayer(DF, ly, sourcely, False) The folder path containing my mxd's is: "C:/Users/enclume/Carto/Cartes/UpdateTest"
It looks fine when I run it, no error message, but nothing changes in the mxd. What am I doing wrong? As you see it, what is the expected outcome of this code segment?
If I ever find a solution, I would like to loop it. As I understands it, looping would repeat the updateLayer script to every mxd's in the specified file. But if it contains some subfolders, will the looping function find all mxd's in the folder and subfolder?
On the previously linked post, the person who wrote the comment said it would be possible to loop it using glob.glob. Can't find anything one this.
I also saw Improving performance of looping over MXDs using ArcPy? which is about looping mxd's, but I can't seem to find a way to fuse those 2 scripts.
I'm new to using arcpy.
Can anyone help me with this 2-fold problem?