>>> from arcpy import env ... env.workspace=r"c:\165mxd" ... out = r"c:\166mxd" ... before = r"165" ... after = r"166" ... for f in arcpy.ListFiles("*.mxd"): ... print f ... mxd = arcpy.mapping.MapDocument(env.workspace + "\\" + f) ... mxd.findAndReplaceWorkspacePaths(before,after,False) ... if not os.path.exists(out): ... os.makedirs(out) ... mxd.saveACopy(out +"\\"+ f )