I had a bunch of shp files inputted in my mxds. and we renamed these shp files and the link in my mxds got broken. The easiest way is to open the mxd, set the data source and click the renamed shp files or use the arc catalog. However, I need to do the fixing of broken links to 700 mxds., this can be overwhelming. I am trying to find a python code/script that can be used in order to fix these broken links but unfortunately, I can't find any that works. Can anyone help me with this? It will be greatly appreciated if anyone can give me a script for this.
Ps: I tried using this script from ArcGIS Help 10.1 but it is not working
import arcpymxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")for lyr in arcpy.mapping.ListBrokenDataSources(mxd): if lyr.supports("DATASOURCE"): if lyr.dataSource == r"C:\Project\Data\Transportation.gdb\MajorRoads": lyr.replaceDataSource(r"C:\Project\Data\Transportation.gdb", "FILEGDB_WORKSPACE", "Highways") lyr.name = "Highways"mxd.saveACopy(r"C:\Project\Project2.mxd")del mxd