Advertisement
Guest User

Untitled

a guest
Aug 20th, 2014
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. #import modules
  2. import arcpy
  3. import os
  4. import glob
  5.  
  6. #set parameters for inputs
  7. mxdinloc = arcpy.GetParameterAsText(0)
  8. mxdoutvers = arcpy.GetParameterAsText(1)
  9.  
  10. #set the values for input versions of ArcMap
  11. if mxdoutvers == "10.1":
  12. version = "10.1"
  13. suffix = "_101"
  14. elif mxdoutvers == "10.0":
  15. version = "10.0"
  16. suffix = "_10"
  17. elif mxdoutvers == "9.3":
  18. version = "9.3"
  19. suffix = "_93"
  20. elif mxdoutverw == "9.2":
  21. version = "9.2"
  22. suffix = "_92"
  23.  
  24. #DowngradeVersions
  25. mxdinloc = os.getcwd()
  26. for pathname, directories, filenames in os.walk(mxdinloc):
  27. for filename in filenames:
  28. if filename.lower().endswith(".mxd"):
  29. #set current map document workspace to handle equal to mxd
  30. mxd = arcpy.mapping.MapDocument(os.path.join(mxdinloc, filename))
  31. filename, ext = os.path.splitext(os.path.join(mxdinloc, filename))
  32. if mxd.dateSaved:
  33. print mxd.dateSaved
  34. mxd.saveACopy(filename + suffix + ext, version)
  35. currentMxd = filename + suffix + ext
  36. mapDoc=arcpy.mapping.MapDocument(currentMxd)
  37. print "Updated: " + filename
  38. else:
  39. print filename + " did not update."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement