I need to change from one FGDB to another.
import arcpy, os
# Set current workspace
arcpy.env.workspace = os.getcwd()
# For every mxd in the current directory
for mxd in os.listdir(''):
if mxd.endswith('.mxd'):
print "Changing paths in "+mxd+"..."
mxd = arcpy.mapping.MapDocument(mxd)
# Note: Back slashes seemed to be required for it to work.
mxd.findAndReplaceWorkspacePaths(r"c:\junk\fgdb\python\b.gdb", r"c:\junk\fgdb\python\a.gdb")
mxd.save()
del mxd
How are you running your scripts? (ArcToolBox, Pythonwin, command line, etc).
How does it know which folder the MXDs are in?
What if the MXDs are in a different folder than the GDB?