Solved! Go to Solution.
import arcpy mxd = arcpy.mapping.MapDocument(mxd_path) df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] sourceLayer = arcpy.mapping.Layer(layerfile_path) for lyr in arcpy.mapping.ListLayers(mxd,'',df): if lyr.isRasterLayer == True: arcpy.mapping.UpdateLayer(df, lyr, sourceLayer, True) print lyr.name mxd.saveACopy(r"E:\Test2.mxd") del lyr, mxd
import arcpy mxd = arcpy.mapping.MapDocument(r"E:\Scott Created GIS Files\MXDs\UpdateImagery2.mxd") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] updateLayer = arcpy.mapping.ListLayers(mxd, "updateLayer", df)[0] sourceLayer = arcpy.mapping.Layer(r"E:\Scott Created GIS Files\MXDs\sourceLayer.lyr") arcpy.mapping.UpdateLayer(df, updateLayer, sourceLayer, True) mxd.saveACopy(r"E:\Scott Created GIS Files\MXDs\UpdateImagery_3.mxd")
import arcpy mxd = arcpy.mapping.MapDocument(mxd_path) df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] sourceLayer = arcpy.mapping.Layer(layerfile_path) for lyr in arcpy.mapping.ListLayers(mxd,'',df): if lyr.isRasterLayer == True: arcpy.mapping.UpdateLayer(df, lyr, sourceLayer, True) print lyr.name mxd.saveACopy(r"E:\Test2.mxd") del lyr, mxd