Consolidates a locator or composite locator by copying all locators into a single folder.
Illustration
The output folder structures of a locator and a composite locator that have been consolidated.
Usage
Locators stored in a geodatabase are not accessible. If you want to consolidate a composite locator, make sure that the participating locators are not stored in a geodatabase.
A warning is issued when this tool encounters an invalid locator. The invalid locator will not be packaged.
Finds and creates individual consolidated folders for all the locators that reside in a specified folder.
# Name: ConsolidateLocator.py
# Description: Find all the locators that reside in a specified folder and create a consolidated folder for each locator.
# import system modules
import os
import arcpy
# Set environment settings
arcpy.env.overwriteOutput = True
arcpy.env.workspace = "C:/MyData/Locators"
# Loop through the workspace, find all the loc and create a consolidated folder using the same
# name as the original locator
for loc in arcpy.ListFiles("*.loc"):
print("Consolidating " + loc)
arcpy.management.ConsolidateLocator(loc, os.path.splitext(loc)[0])