# Extract file paths from logs and text

Paste build logs, stack traces, git status output, or prose and extract deduplicated POSIX or Windows file paths as a list, CSV, or JSON.

## Run it

- **CLI:** `gizza tool path-extractor 'error[E0308]
  --> src/main.rs:42:9
modified: docs/readme.md
open C:\Users\me\app.log'`
- **Web:** https://gizza.ai/tools/path-extractor/
- **Agents:** machine-readable descriptor (parameters JSON Schema) at https://gizza.ai/tools/path-extractor/tool.json

## Inputs

- `text` — Text to scan _(field)_
- `path_style` — Path style _(field)_
- `require_separator` — Require / or \ in each match _(field)_
- `keep_line_numbers` — Keep :line and :column suffixes _(field)_
- `output` — Return _(field)_
- `extensions` — Extension filter _(field)_
- `extension_mode` — Extension mode _(field)_
- `dedupe` — Deduplicate repeated paths _(field)_
- `sort` — Sort order _(field)_
- `format` — Output format _(field)_

## Output

- Extracted paths (text)

## Query parameters

Open the tool pre-filled and auto-run via URL:

- `text` — Text to scan
- `path_style` — Path style
- `require_separator` — Require / or \ in each match
- `keep_line_numbers` — Keep :line and :column suffixes
- `output` — Return
- `extensions` — Extension filter
- `extension_mode` — Extension mode
- `dedupe` — Deduplicate repeated paths
- `sort` — Sort order
- `format` — Output format

Example: `https://gizza.ai/tools/path-extractor/?text=error%5BE0308%5D%0A%20%20--%3E%20src%2Fmain.rs%3A42%3A9%0Amodified%3A%20docs%2Freadme.md%0Aopen%20C%3A%5CUsers%5Cme%5Capp.log&path_style=any&require_separator=true&keep_line_numbers=true&output=path&extensions=rs%2C%20toml%2C%20md&extension_mode=include&dedupe=true&sort=first-seen&format=list`

---

## About this tool

Use Path Extractor when you have noisy text — a compiler log, a Python traceback, `git status`, CI output, or a pasted chat message — and you only want the file paths. It recognizes common POSIX paths, Windows drive paths, UNC shares, quoted paths with spaces, and source locators such as `src/main.rs:42:9` or `src\main.c(12,4)`.

Worked example: paste this log:

```text
error[E0308]: mismatched types
  --> src/main.rs:42:9
warning: unused import in src/main.rs
   Compiling foo (/home/dev/projects/foo)
```

With the defaults, the output is:

```text
src/main.rs
/home/dev/projects/foo
```

Turn on “Keep :line and :column suffixes” when you want `src/main.rs:42:9` in the list. Change “Return” to `Filename only` for `main.rs`, or to `Directory only` for `src`. Use the extension filter to keep just files like `rs, toml, md`, and switch the output format to CSV or JSON when you need occurrence counts or line/column metadata.

Limits and edge cases: the scanner is shape-based and never checks whether a file exists on disk. URLs, dates, numeric ratios, and ordinary prose are intentionally ignored. Bare filenames such as `main.rs` are matched only when “Require / or \ in each match” is turned off, because that mode is higher-recall and more ambiguous. Input is capped at about 1 MB and 20,000 path occurrences.

## FAQ

<details>
<summary>Does this check whether the files actually exist?</summary>

No. The tool runs locally in a browser or sandboxed WebAssembly block and never stats the filesystem. It extracts strings that look like paths, then filters, deduplicates, sorts, and formats them.

</details>

<details>
<summary>Why are line numbers stripped by default?</summary>

Most users want a reusable file list, so `src/main.rs:42:9` becomes `src/main.rs` by default. Enable “Keep :line and :column suffixes” when you are pasting output into an editor, quickfix list, or another tool that understands locators.

</details>

<details>
<summary>How do I extract only filenames or directories?</summary>

Set “Return” to `Filename only` to turn `src/app/main.rs` into `main.rs`, or to `Directory only` to return `src/app`. Deduplication happens after this projection, so repeated filenames or directories are counted together.

</details>

<details>
<summary>Why did it miss a bare filename like main.rs?</summary>

The default requires a slash or backslash because bare words with dots are easy to confuse with versions, decimals, prose, or domain-like text. Turn off “Require / or \ in each match” to opt into bare extension-bearing filenames such as `main.rs` and `Cargo.toml`.

</details>

## Related tools

- [Extract Action Items from Meeting Notes](https://gizza.ai/tools/action-item-extractor/): Extract action items, owners, and decisions from meeting notes or daily notes with deterministic rules. Markdown checklist or JSON, private in-browser.
- [Add Line Numbers](https://gizza.ai/tools/add-line-numbers/): Add line numbers to every line of text online, like nl or cat -n — custom start, step, separator, and alignment. Free and private, runs in your browser.
- [ANSI Log Renderer](https://gizza.ai/tools/ansi-log-renderer/): Paste ANSI-colored terminal output or CI logs and render them as HTML, or strip escape codes to plain text. Handles 16-color, 256-color, and truecolor SGR codes.
- [API response diff](https://gizza.ai/tools/api-response-diff/): Compare two JSON API responses and see only the meaningful changes: ignore request ids, timestamps and UUIDs, match arrays by key or as sets, export a JSON Patch.
- [Rust AST Diff](https://gizza.ai/tools/ast-diff/): Compare two Rust source snippets structurally. The tool parses both files, canonicalizes their ASTs, and ignores formatting, whitespace, and comments.
