Hello ESRI community.
We ar willing to migrate or work from ArcMap to ArcGIS Pro. We have over 200 mxd we need to export to APRX. We are not motivated to do that manualy. We would rather use a python script to do so.
We got this in the web how ever, it doesn't work. My colleague and I are not python user so it's complcated.
Moreover we want that the mxd data not to stored into the gdb of the project but to the shapefile. All the MXD we have, have only 5 common shapefiles data on a specific folder. we want to keep the data sources where they currently are.
here is the script we started:
import arcpy
import pathlib
import os
ogDir =input('path to mxd folder')
dirContents = os.listdir(ogDir)
for folder_path, subfolders, filenames in os.walk(ogDir):
for file in filenames:
if file[-4:] == '.mxd':
aprx = arcpy.mp.ArcGISProject(r'path to blank.aprx')
filePath = pathlib.Path(folder_path) / file
mxd = file[:-4]
aprx.importDocument(filePath)
aprx.saveACopy(folder_path + '\\' + mxd + '.aprx')
after mxd=file[:-4] i have the following comment:
IndentationError: unexpected indent
then
IndentationError: unexpected indent
>>> aprx.importDocument(filePath)
File "<stdin>", line 1
aprx.importDocument(filePath)
IndentationError: unexpected indent
>>> aprx.saveACopy(folder_path + '\\' + mxd + '.aprx')
If you have bette script I would take it.
Final question car we run the script here?