Categories

Path Analyzer

Analyze file paths, identify Windows/Unix formats, extract components, and normalize paths

Features

Comprehensive file path analysis supporting multiple formats:

  • Windows Paths: C:\path\to\file.txt with drive letter detection
  • Unix Paths: /path/to/file.txt with root directory
  • UNC Paths: \\server\share\file.txt network paths
  • Relative Paths: ./path/file.txt or ../parent/file.txt

Analysis

Extracts complete path components:

  • Root: Drive letter or root directory
  • Directory: Full directory path
  • Filename: Base filename with extension
  • Name: Filename without extension
  • Extension: File extension (including dot)
  • Depth: Number of directory levels

Normalization

Convert paths between formats:

  • Convert Windows to Unix (backslash to forward slash)
  • Convert Unix to Windows (forward slash to backslash)
  • Auto-detect and normalize based on path content

Detection

Identifies:

  • Path type (Windows, Unix, UNC, relative, absolute)
  • Platform type (Windows, Unix, unknown)
  • Absolute vs relative paths
  • Trailing separator presence

Display root, drive, directory, name, and extension separately

Key Facts

Category
Development
Input Types
text, select, checkbox
Output Type
json
Sample Coverage
4
API Ready
Yes

Overview

The Path Analyzer tool dissects file paths to identify their format, extract components like root, directory, and filename, and normalize separators between Windows and Unix platforms. It supports Windows, Unix, UNC, and relative paths for accurate analysis.

When to Use

  • When you need to identify the format of a file path for cross-platform compatibility checks.
  • When converting file paths between Windows and Unix systems in development or scripting tasks.
  • When debugging path-related errors by analyzing components such as root, directory, and extension.

How It Works

  • Enter a file path into the input field, such as 'C:\Users\file.txt' or '/home/user/doc.pdf'.
  • Optionally select a normalization platform (auto, Windows, or Unix) to convert path separators.
  • The tool detects the path type, extracts components, and displays them in a structured JSON output.
  • Toggle the detailed components option to view root, drive, directory, name, extension, and depth separately.

Use Cases

Cross-platform software development where file paths must be consistent across operating systems.
File system management tasks like organizing, migrating, or validating files with different path formats.
Scripting and automation where parsing paths is essential for file operations or error handling.

Examples

1. Analyze a Windows Absolute Path

Background
A developer is troubleshooting a script that fails to locate a file on a Windows system.
Problem
The script cannot parse the path 'C:\Users\John\Documents\report.txt' correctly.
How to Use
Enter the path into the Path Analyzer with showDetailed enabled.
Example Config
normalizePlatform: 'auto', showDetailed: true
Outcome
The tool identifies it as a Windows absolute path, extracts root 'C:', directory '\Users\John\Documents', filename 'report.txt', name 'report', extension '.txt', and depth 3.

2. Normalize a Mixed-Separator Path for Windows

Background
A web application generates paths with forward slashes on a Windows server, causing command-line issues.
Problem
The path 'C:/Program Files/app/config.ini' uses forward slashes, which are not recognized by Windows tools.
How to Use
Input the path and set normalizePlatform to 'windows'.
Outcome
The tool converts it to 'C:\Program Files\app\config.ini' with backslashes for Windows compatibility.

3. Extract Components from a UNC Network Path

Background
An IT administrator needs to log details of a network path for audit purposes.
Problem
The UNC path '\\server\share\folder\file.doc' has multiple components to document.
How to Use
Enter the UNC path and analyze with detailed components enabled.
Outcome
The tool detects it as a UNC path, extracts root '\\server\share', directory '\folder', filename 'file.doc', and depth 2.

Try with Samples

development

Related Hubs

FAQ

What path formats are supported?

Windows paths (e.g., C:\path\file.txt), Unix paths (/path/file.txt), UNC paths (\\server\share\file.txt), and relative paths (./file.txt).

Can I normalize paths to a specific platform?

Yes, choose to normalize to Windows (backslashes), Unix (forward slashes), or auto-detect based on the path content.

What components are extracted from a path?

Root, directory, filename, name (without extension), extension, and depth (number of directory levels).

Is the tool free to use?

Yes, this is a free online utility tool with no cost or registration required.

How does the tool detect the path type?

It analyzes separators, drive letters, root indicators, and structure to determine if the path is Windows, Unix, UNC, relative, or absolute.

API Documentation

Request Endpoint

POST /en/api/tools/path-analyzer

Request Parameters

Parameter Name Type Required Description
pathInput text Yes -
normalizePlatform select No -
showDetailed checkbox No Display root, drive, directory, name, and extension separately

Response Format

{
  "key": {...},
  "metadata": {
    "key": "value"
  },
  "error": "Error message (optional)",
  "message": "Notification message (optional)"
}
JSON Data: JSON Data

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-path-analyzer": {
      "name": "path-analyzer",
      "description": "Analyze file paths, identify Windows/Unix formats, extract components, and normalize paths",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=path-analyzer",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

If you encounter any issues, please contact us at [email protected]