Im looking for a way to get the name and path of a layer file which is used in an MXD. I know once a layer file is added to a MXD, the path info is not stored, which is problematic.
Essentially the end goal is to use arcpy.mapping
module to update a bunch of layers within any MXD. using the following code
arcpy.mapping.UpdateLayer(maindataframe, updateLayer, sourceLayer, True)
We have a folder structure where all our layer files are connected to a mix of SDE and GDB's. And to find a way to make a table of all the layers with the paths would be a godsend.
The question is, is there a way to programmaticly run though each folder and sub folders (maybe using os.walk?) and get the layer name used in ArcMap (in this case, the updatelayer), and the path (sourcelayer) to get this format -> [River System,r'C:\Catchments\Area\River_Catchments.lyr']
Edit: I should point out that this is not to update the datasource, but the path of where it is found. The reason I need this is that there are old MXD's that contain old/dated symbology and need to be updated. By updating the layer with the one in the folder structure I can update multiple MXD's at once.
arcpy.mapping.ListLayers()