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
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
developmentRelated 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.