Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import modules
- import arcpy
- import os
- import glob
- #set parameters for inputs
- mxdinloc = arcpy.GetParameterAsText(0)
- mxdoutvers = arcpy.GetParameterAsText(1)
- #set the values for input versions of ArcMap
- if mxdoutvers == "10.1":
- version = "10.1"
- suffix = "_101"
- elif mxdoutvers == "10.0":
- version = "10.0"
- suffix = "_10"
- elif mxdoutvers == "9.3":
- version = "9.3"
- suffix = "_93"
- elif mxdoutverw == "9.2":
- version = "9.2"
- suffix = "_92"
- #DowngradeVersions
- mxdinloc = os.getcwd()
- for pathname, directories, filenames in os.walk(mxdinloc):
- for filename in filenames:
- if filename.lower().endswith(".mxd"):
- #set current map document workspace to handle equal to mxd
- mxd = arcpy.mapping.MapDocument(os.path.join(mxdinloc, filename))
- filename, ext = os.path.splitext(os.path.join(mxdinloc, filename))
- if mxd.dateSaved:
- print mxd.dateSaved
- mxd.saveACopy(filename + suffix + ext, version)
- currentMxd = filename + suffix + ext
- mapDoc=arcpy.mapping.MapDocument(currentMxd)
- print "Updated: " + filename
- else:
- print filename + " did not update."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement