I have a python script which reads through all the mxd's in a folder and changes their properties from relative file paths to absolute file paths.
I now want to add a bit to the script to change the version of the mxd from 10.1 to 10.0.
I want the 10.0 mxd to be saved into a pre-defined folder.
The new mxd should have the same name as the original mxd. This is the bit I'm struggling with.
How do I get the name of the original mxd? (defined as basename in the code below). I'm assuming I need to use an arcpy.mapping function, but I'm completely stumped.
import arcpy, os
#workspace to search for MXDs
Workspace = r"C:\Testing\ImageMapperReplacement\LRM157"
arcpy.env.workspace = Workspace
#list map documents in folder
mxdList = arcpy.ListFiles("*.mxd")
#set relative path setting for each MXD in list.
for file in mxdList:
#set map document to change
filePath = os.path.join(Workspace, file)
mxd = arcpy.mapping.MapDocument(filePath)
#Get the file name
basename = ??????
#set relative paths property
mxd.relativePaths = False
#save map doucment change
mxd.saveACopy (r"C:\Testing\ImageMapperReplacement\LRM157\mxd2\\" + basename + ".mxd", {10.0})
file
variable. Note: you shouldn't usefile
as a variable as you're overriding the built in function