Concatenate and print the contents of all files in a directory and its subdirectories.
Project description
catdir
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
License
MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file catdir-0.1.1.tar.gz.
File metadata
- Download URL: catdir-0.1.1.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df235b4815e65a0356332057cac82e9f621d218cf4681c6c620cc3dafd68d60d
|
|
| MD5 |
5271940e9852071c5b41087d96c71a3b
|
|
| BLAKE2b-256 |
0811a20169dccb6128d5af1d0bf5c185899934a561ca88d6fc789a5ebbf50fcf
|
File details
Details for the file catdir-0.1.1-py3-none-any.whl.
File metadata
- Download URL: catdir-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
518a080d0b7863ee6cd4fe4b061381b0eb6e8224e599604239fe76e4c840b77f
|
|
| MD5 |
75e1e210daad180bef3a699b2a22362f
|
|
| BLAKE2b-256 |
e6535eaece3c569e82e169abfed1c646a6e04bc8c60a5be92710f88398aa0d90
|