---
title: pun list-files
description: List the files a command selects after paths and exclusions.
---

`pun list-files` prints one path per line, sorted and relative to the project root.

```bash
pun list-files
pun list-files --command analyse
pun list-files -0 app | xargs -0 wc -l
pun list-files --format json
```

## File selection

| Selection | Paths | Exclusions |
| --- | --- | --- |
| Default | `[files] paths`, otherwise the project root | `[files] exclude` |
| `--command format` | Shared paths | Format exclusions, Pint finder rules, and Blade unless enabled |
| `--command lint` | Shared paths | Lint exclusions, Blade, and default excluded directories |
| `--command analyse` | `[analyse] paths`, otherwise shared paths | Analyse exclusions, Blade, and default excluded directories |

Command exclusions include `[files] exclude`. The default excluded directories are `bootstrap/cache`, `build`, `node_modules`, and `storage`.

Path arguments replace the configured paths. Outside format, exclusions still apply to files you name. `vendor/` is never listed, though analysis reads it for symbols.

For example, with this config the default selection includes `app` and `tests`, and the analyse selection includes only `app`:

```toml
[files]
paths = ["app", "tests"]
exclude = ["storage/**"]

[analyse]
exclude = ["tests/**"]
```

## Options

| Flag | Meaning |
| --- | --- |
| `--command format\|lint\|analyse` | Select a command's file set. |
| `-0`, `--zero-terminate` | End each path with a NUL byte, for `xargs -0`. |
| `--format json` | Print a JSON array. |
| `--config <path>` | Read another `pun.toml`. |

Under a coding agent, the summary line goes to stderr, so stdout stays safe to pipe.
