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?
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.