> ## Documentation Index
> Fetch the complete documentation index at: https://opensre.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Counting files

> Ask how many files of a kind a directory holds and get the project's files, not its caches

## Overview

OpenSRE counts the files that belong to your project: the modules you wrote,
not the compiled caches and vendored packages sitting beside them. Ask in the
interactive shell (`opensre`):

```
How many test files are under tests/interactive_shell?
How many Python files does surfaces/interactive_shell have?
How many workflow files are in .github/workflows?
```

## What you get back

One sentence naming the count, the pattern and the directory:

```
103 files matching test_*.py under tests/interactive_shell, not counting
generated directories
```

Up to twenty matching paths come back as examples. The count itself always
covers the whole tree.

## What is skipped

Directories whose contents are generated, vendored, or version-control
bookkeeping: `__pycache__`, `.venv`, `venv`, `site-packages`, `node_modules`,
`build`, `dist`, `.git`, and the `.mypy_cache`, `.pytest_cache`, `.ruff_cache`
and `.tox` caches.

Symlinked directories are not followed, so a link pointing back up the tree
cannot make the count run away.

## What it does not do

* Counting entries inside a YAML, JSON or TOML file is a different question:
  see [Structured file reads](/docs/structured-file-tool).
* Searching file contents is a shell command with `rg`.
* Listing every file name: you get the count and a few examples.
