Skip to main content

Concatenate and print the contents of all files in a directory and its subdirectories.

Project description

catdir

PyPI version Python versions License CI/CD

catdir is a simple CLI utility that traverses directories and concatenates the contents of all files within a folder and its subfolders, similar to the Unix cat command — but for entire directory trees.

This tool is particularly useful for diagnostics, debugging, packaging, or reviewing all source files in a project at once.

Installation

Install using pip:

pip install catdir

Usage

catdir [OPTIONS] PATH

Example

catdir ./my_project --exclude .env --exclude-noise
catdir ./my_project -e .env -en
catdir ./my_project -e .env -en >> dump.txt

These commands output the contents of all readable files under ./my_project, excluding .env and commonly ignored development artifacts such as .git, node_modules, .venv, and others. The last example redirects the output to a file named dump.txt.


Options

Option Description
-e, --exclude Manually exclude specific files or folders by name (can be used multiple times).
-en, --exclude-noise Automatically exclude common development artifacts (e.g., .git, .venv, etc.).
-h, --help Show usage instructions.

Output Format

Each file is prefixed and suffixed with a marker to identify its contents:

# relative/path/to/file.py start file content
<file content here>
# end file content

If a file or directory cannot be read, the tool will emit an inline error comment with the reason.


What Is Excluded with --exclude-noise?

The --exclude-noise flag excludes the following by default:

.venv, venv, .git, .idea, __pycache__, node_modules, dist, build,
.pytest_cache, .mypy_cache, .cache, .eggs, .coverage, coverage.xml,
.tox, .DS_Store, Thumbs.db, .env

Development

To install and run locally:

git clone https://github.com/yourname/catdir.git
cd catdir
pip install -e .
catdir ./example_project --exclude-noise

See CONTRIBUTING.md for contribution guidelines.

We welcome PRs and ideas — see issues, or open a new one.


License

MIT License. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

catdir-0.1.2.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

catdir-0.1.2-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file catdir-0.1.2.tar.gz.

File metadata

  • Download URL: catdir-0.1.2.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.17

File hashes

Hashes for catdir-0.1.2.tar.gz
Algorithm Hash digest
SHA256 76b7421b73d935ddf01b05250ffeed695d6e05539179af000d6746cbe86f42f9
MD5 4b98752d2cf79eff30b41e8e88782306
BLAKE2b-256 93c2cefcaadafb8cc913eeca06d4e1cf597932982b2013b8f5153573166318ef

See more details on using hashes here.

File details

Details for the file catdir-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: catdir-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.17

File hashes

Hashes for catdir-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a7b019939525a857aaad24de6454572c080408001040bafa3fce8ea7f3411215
MD5 744d77accb979f9a7cdfaa3e8621662a
BLAKE2b-256 b5ac6d21ca8e60baf68ea7fbdd29ede48d607ed4e4cdabb027b3e735f1b6892a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page