Select to view content in your preferred language

Changing an aprx relative path to UNC path

231
0
05-24-2023 12:53 PM
YasnaiaMassie
New Contributor

Hello there,

I am trying to changing an aprx file relative path to a UNC path.
I am using the following code, which is not working.
My idea is having a code that I could use for changing relative path to UNC path for other aprxs. 
Any suggestions??

import arcpy, os, sys, string
folderPath= r"K:\Projects\TemporaryYM"
for filename in os.listdir(folderPath):
fullpath = os.path.join(folderPath, filename)
if os.path.isfile(fullpath):
basename, extension = os.path.splitext(fullpath)
if extension.lower() == ".aprx":
aprx = arcpy.mp.ArcGISProject (fullpath)
aprx.findAndReplaceWorkspacePaths (r"K:\Projects\TemporaryYM", r"\\ct\dfs11\D11Gis\Projects\TemporaryYM")
aprx.save()
del aprx

Tags (1)
0 Kudos
0 Replies