dunderwo_CityofEscondido

How to mxd.findAndReplaceWorkspacePaths Mutiple mxds

Discussion created by dunderwo_CityofEscondido on Jun 20, 2018
Latest reply on Jun 20, 2018 by dunderwo_CityofEscondido
import arcpy
import os

original = r'Database Connections\ABC.sde'
new = r'Database Connections\EFG.sde'

# Set folder space
folderPath = r'mylocation'
arcpy.env.workspace  = folderPath
arcpy.env.overwriteOutput = True

# Loop folder directoy and get all mxd full paths
for root, dirs, files in os.walk(folderPath):
    for file in files:
        if file.lower().endswith(".mxd"):
            fullpath = os.path.join(root, file)
            mxd = arcpy.mapping.MapDocument(fullpath)  # loop all folder mxd
            mxd.findAndReplaceWorkspacePaths(original,new)
del mxd

Outcomes