ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • ArcGIS Pro
  • ArcMap
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • ArcGIS Pro
  • ArcMap
Esri
English
  • English
  • Deutsch
  • Español
  • Français
  • 日本語
  • Русский
  • 简体中文
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions
  • Tools
  • Tool reference
  • ModelBuilder toolbox
  • Model Only toolset
  • Back to Top
  • An overview of the ModelBuilder toolbox
  • ModelBuilder toolbox licensing
  • Iterator toolset

    • An overview of the Iterator toolset
    • For
    • While
    • Iterate Feature Selection
    • Iterate Row Selection
    • Iterate Field Values
    • Iterate Multivalue
    • Iterate Datasets
    • Iterate Feature Classes
    • Iterate Files
    • Iterate Rasters
    • Iterate Tables
    • Iterate Workspaces
    • Iterator toolset concepts

    Model Only toolset

    • An overview of Model Only toolset
    • Calculate Value
    • Collect Values
    • Get Field Value
    • Merge Branch
    • Parse Path
    • Select Data
    • Stop
    • Model Only toolset concepts

    Parse Path

    This ArcGIS 10.4 documentation has been archived and is no longer updated. Content and links may be outdated. See the latest documentation.
    • Summary
    • Usage
    • Syntax
    • Environments
    • Licensing information

    Summary

    The Parse Path tool parses the input into its file, path, name, or extension. The output can be used as in-line variables in the output name of other tools.

    Learn how Parse Path works in ModelBuilder

    Usage

    • This tool is intended for use in ModelBuilder and not in Python scripting.

    • Parsing results are controlled by the Parse Type parameter. Example: If the input to the Parse Path tool is C:\ToolData\InputFC.shp, then

      Parse TypeResult
      File name and extension InputFC.shp
      File pathC:\ToolData
      File nameInputFC
      File extensionshp

    • The same functionality can be accessed in scripting with the Python os module. For example if you pass an input variable:

      Input = "C:\ToolData\InputFC.shp", then

      • To get the file InputFC.shp

        import os

        os.path.basename(Input)

      • To get the file path C:\ToolData

        import os

        os.path.dirname(Input)

      • To get the file name InputFC

        import os

        os.path.basename(Input).rstrip(os.path.splitext(Input)[1])

      • To get the file extension shp

        import os

        os.path.splitext(Input)[1].lstrip(".")

    • The output of Parse Path is a string and cannot be connected directly as an input to the tools such as Create Feature Class in parameters like Feature Class Location which requires a workspace data type as input. Use %Value% inline variable substitution in such cases as shown below:

      Parse Path with Create Feature Class tool

    Syntax

    ParsePath_mb (in_data_element, {parse_type})
    ParameterExplanationData Type
    in_data_element

    Input values that you want to parse.

    Any value
    parse_type
    (Optional)

    The parse type. Given the input value of C:\ToolData\InputFC.shp:

    • FILE —Output will be the file. Example: InputFC.shp
    • PATH —Output will be the file path. Example: C:\ToolData
    • NAME —Output will be the file name. Example: InputFC
    • EXTENSION —Output will be the file extension. Example: shp
    String

    Environments

    This tool does not use any geoprocessing environments

    Licensing information

    • ArcGIS Desktop Basic: Yes
    • ArcGIS Desktop Standard: Yes
    • ArcGIS Desktop Advanced: Yes

    Related topics

    • An overview of Model Only toolset
    • A quick tour of using Model Only tools

    ArcGIS Desktop

    • Home
    • ArcGIS Pro
    • ArcMap
    • Documentation
    • Support

    ArcGIS

    • ArcGIS Online
    • ArcGIS Desktop
    • ArcGIS Enterprise
    • ArcGIS Platform
    • ArcGIS Developer
    • ArcGIS Solutions
    • ArcGIS Marketplace

    About Esri

    • About Us
    • Careers
    • Insiders Blog
    • User Conference
    • Developer Summit
    Esri
    © Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal