I have created a script to import multiple MXD
import arcpy, os, datetime
workspaceMXD = "C:\\Users\\e087607\\Desktop\\"
arcpy.env.overwriteOutput = True
aprx = arcpy.mp.ArcGISProject("Current")
arcpy.env.workspace = workspaceMXD
listFiles = arcpy.ListFiles("*.mxd")
#Import MXD Files
for files in listFiles:
inputMXD = os.path.join(workspaceMXD, files)
print (inputMXD)
aprx.importDocument(inputMXD)
aprx.saveACopy("C:\\Users\\e087607\\Documents\\ArcGIS\\Projects\\import.arpx")
print ("MXD Files: " + str(listFiles) + " were updated at " + str(datetime.time))
I go to run it as normal and takes its time (doesn't run quickly) but none of the files I wanted to copy over showed up. I followed the script example from ESRI word for word. Am I doing something wrong? Is there a different code to use?Please let me know
Thanks Andrew
Can you provide a screenshot of the output of print statements when running your script?
Do you have a link showing the script example provided by ESRI?
Does this help?
I copied your script into the python window of an aprx that I named import just like you. I then ran the script and it added maps named Layers, Layers1, and Layers2 as I imported 3 mxd files. Did you try going to the Catalog pane to see of these maps were added. You then need to right click on the maps in the Catalog pane and click on Open.
Now if you wanted the maps to have the name of the mxd you imported, you'll need to add some additional code.
Can you give an example of the code required to import the MXD file names as Map View names?
Yes. How come it did not pop up in the tool bar
Does your reply mean that the mxds were imported, but you just did not see them at first?