Counting files
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:
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.
- Searching file contents is a shell command with
rg. - Listing every file name: you get the count and a few examples.
Markdown source: View on AtomGit·Content from the open-source project op/opensre