Consolidate Toolbox (Data Management)

Summary

Consolidates one or more toolboxes (a .tbx or .pyt file) to a specified output folder.

Usage

  • Tools and parameters may have been added, removed, or modified between the ArcGIS Pro version installed and the version selected for the Version parameter. If you want to consolidate a toolbox to an earlier version and capabilities that are only available in the newer version are included, the tool will produce warning or error messages based on a comparison of the version compatibility of the tool or tools included in the package.

Syntax

arcpy.management.ConsolidateToolbox(in_toolbox, output_folder, {version})
ParameterExplanationData Type
in_toolbox
[in_toolbox,...]

The toolboxes to be consolidated.

Toolbox
output_folder

The output folder that will contain the consolidated toolbox.

If the specified folder does not exist, a new folder will be created.

Folder
version
(Optional)

Specifies the version of the consolidated toolbox. Specifying a version allows toolboxes to be shared with previous versions of ArcGIS and supports backward compatibility.

  • CURRENTThe consolidated folder will contain tools compatible with the version of the current release. This is the default.
  • 2.1The consolidated folder will contain tools compatible with version 2.1.
  • 2.2 The consolidated folder will contain tools compatible with version 2.2.
  • 2.3The consolidated folder will contain tools compatible with version 2.3.
  • 2.4The consolidated folder will contain tools compatible with version 2.4.
  • 2.5The consolidated folder will contain tools compatible with version 2.5.
  • 2.6The consolidated folder will contain tools compatible with version 2.6.
String

Code sample

ConsolidateToolbox example 1 (Python window)

The following Python window script demonstrates how to use the ConsolidateToolbox tool in the Python window.

import arcpy
arcpy.ConsolidateToolbox_management(r'C:\data\BufferPoints.tbx', 
                                    r'C:\project\Buffer_Pnts', "CURRENT")
ConsolidateToolbox example 2 (stand-alone script)

Find and create individual consolidated folders for all of the toolboxes that reside in a specified folder.

# Name: ConsolidateToolboxEx2.py
# Description:  Find all the toolboxes that reside in a specified folder and 
# create a consolidated folder for each.

# import system modules
import os
import arcpy

# Set environment settings
arcpy.env.overwriteOutput = True
arcpy.env.workspace = "C:/Toolboxes"

# Loop through the workspace, find all the toolboxes (.tbx), and create a 
# consolidated folder for each toolbox found using the same name as the original 
# toolbox.
for tbx in arcpy.ListFiles("*.tbx"):
    print("Consolidating " +  tbx)
    arcpy.ConsolidateToolbox_management(tbx, os.path.splitext(tbx)[0], "CURRENT")

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes