I have a python code I'm running in ArcGIS 10.6 that replaces the data source path of all layers in the mxd with a new path. I'm trying to use a wildcard for the current workspace path as many layers in our template mxd have different data source paths.
The part of code in question is this line:
The r"*" doesn't seem to work as a wildcard.
Here is the full code:
# Importing necessary modules import arcpy, os # Setting path to mxd and Data Frame mxd = arcpy.mapping.MapDocument(r"CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "UTM_12") #List layers and replace current path with new path for lyr in arcpy.mapping.ListLayers(mxd, "*", df): mxd.findAndReplaceWorkspacePaths(r"*", r"P:\JOBS\2018\18-9992\Drawings\GIS") #Delete any layers with broken links (no datasource) for lyr in arcpy.mapping.ListLayers(mxd, "*", df): if lyr.isBroken: arcpy.mapping.RemoveLayer(df, lyr) # Saving the mxd mxd.save()