Skip to main content

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


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.0.tar.gz (6.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.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: catdir-0.1.0.tar.gz
  • Upload date:
  • Size: 6.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.0.tar.gz
Algorithm Hash digest
SHA256 3d9c519b726819e81db3abe4ab571c4e6fd18f6448c03fdc6ffb1333f84c8925
MD5 00448cba116e3547b570a10813ec95fc
BLAKE2b-256 5679aa361adb0755f7a2f56dfd14314857b750aa605e87ad230f90d7d0decfe7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: catdir-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c22179aa3eed754dd33403f93e1f630c752ba872a1e7f1d7ad33a89621b300f
MD5 84a17432759a243389d4912d4859c711
BLAKE2b-256 c602e7c80681ee9baa28305dca70863958c1ed630403707af5dc9cc2f835776e

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