I need to change thousands of LYR files to use relative paths instead of absolute. Following the example in help I got this:import arcpy, osfolderPath = r"C:\Testing\ArcGIS10_release\paths"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() == ".lyr": lyr = arcpy.mapping.Layer(fullpath) lyr.findAndReplaceWorkspacePath (r"C:\Testing\ArcGIS10_release\paths", r"\\ Testing\ArcGIS10_release\paths ") lyr.save()del lyrThe paths are coming out as broken when I move them to the same path but a different directory (D:\Testing\ArcGIS10_release\paths). I think I need to append the file name on the end of the path for this to work - but am not sure how.Any help?
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.