Solved! Go to Solution.
#Importing Modules import arcpy from arcpy import env #Put file path for the folder containing mxds, where I have my sample file path env.workspace = r"C:\Test\MXDfolder" #Put file path for the folder, gdb, feature dataset, or sde connection containing the files your map layers will be referencing here, where I have my sample file path replace_workspace_path = r"C:\Test\NewWorkspace" #Looping through all filepaths in our workspace, make a map document object out of them, then replace their workspace path for file in arcpy.ListFiles("*.mxd"): mxd = arcpy.mapping.MapDocument(file) mxd.findAndReplaceWorkspacePaths(" " , replace_workspace_path) mxd.save() del file; del mxd
I haven't tried it yet but I guess what I'm trying to do is change the dataset for a layer but do it for every MXD's. Does that make sense. Maybe you already knew that...
Either way I'm looking at your code.
Thanks