Skip to main content

Dump all text files in a directory tree into a single file

Project description

treedump v0.2.0

treedump walks a directory tree and produces a single text dump containing:

  1. The directory tree structure (first)
  2. The contents of all text files in that tree (second)

Binary files are never dumped.
The output file itself is never re-ingested.

By default, hidden files and directories are excluded.

This tool is designed for:

  • code review and audits
  • LLM context ingestion
  • archiving project snapshots
  • inspecting unfamiliar repositories

Installation

Install from PyPI:

pip install treedump

For development or local testing:

pip install -e .

Basic usage

Run in any directory:

treedump

This creates dump.txt in the current directory.


Output format

The output is structured and deterministic.

Tree structure is always written first, followed by file contents.

Example:

===== TREE STRUCTURE =====
.
./src
./src/main.py
./README.md
===== END TREE STRUCTURE =====

===== FILE: src/main.py =====
<file contents>
===== END FILE: src/main.py =====

===== FILE: README.md =====
<file contents>
===== END FILE: README.md =====

Ignore behavior (important)

Default behavior

Ignore rules are determined as follows:

  1. If a .gitignore file exists in the current directory:

    • Only .gitignore rules are used
    • Built-in defaults are NOT applied
  2. If no .gitignore exists:

    • A safe built-in ignore list is used

The built-in ignore list includes:

  • version control and tooling directories
    .git/, __pycache__/, venv/, .venv/, node_modules/,
    .mypy_cache/, .pytest_cache/, .idea/, .vscode/

  • compiled and noisy artifacts
    *.pyc, *.log

  • secret-bearing files
    .env, .env.*, *.env
    .secrets, .secrets.*
    *.key, *.pem, *.crt, *.p12, *.keystore
    id_rsa, id_ed25519, *.pub
    credentials, credentials.*
    .aws/, .ssh/

Hidden files are excluded by default at the directory traversal level.


Ignore options

Disable all ignore rules

treedump --ignore-off

When this flag is used:

  • all ignore rules are disabled
  • binary files are still skipped
  • the output file is still excluded

Use with care.


Add ignore files

treedump --ignore .gitignore custom.ignore

Ignore files use simple glob-style patterns.
Empty lines and comments (#) are ignored.


Add ignore patterns inline

treedump --ignore-pattern "*.sql" "*.db"

Ignore files and inline patterns are additive unless --ignore-off is specified.


Other options

Change output file name

treedump --output project_dump.txt

Omit tree structure

treedump --no-tree

Only file contents will be written.


Include hidden files and directories

treedump --include-hidden

Includes dotfiles and dot-directories (such as .env, .git/, .github/), subject to ignore rules.


Show version

treedump --version

Requirements

  • Python 3.9 or newer
  • External commands available in PATH:
    • tree
    • file

These are standard on most Unix-like systems.


Philosophy

treedump follows classic Unix principles:

  • structure before content
  • text-only by default
  • hidden files excluded unless explicitly requested
  • explicit behavior over clever inference
  • safe defaults with deliberate escape hatches
  • boring, predictable output

It intentionally does less than a full indexing or archival system.


License

MIT

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

treedump-0.2.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

treedump-0.2.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file treedump-0.2.0.tar.gz.

File metadata

  • Download URL: treedump-0.2.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for treedump-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ee22dfbb4b0951212351ac073df56a42e9415471f6085068d34bf788e5e1857f
MD5 5334552e80f5a3e1b7bc447694424a05
BLAKE2b-256 c2aaa4c7b3adc304248f83640a31f1efe3553c90b8901d9bd842c10e8ff9ce47

See more details on using hashes here.

Provenance

The following attestation bundles were made for treedump-0.2.0.tar.gz:

Publisher: python-publish.yml on appfeat/treedump

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file treedump-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: treedump-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for treedump-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 27ee9a0d89fc6b7ba8f01d627274b76e0ba2b655ab980b5986ca1e7955ac13c4
MD5 cde82e1a34eba078e67a5739279e92bf
BLAKE2b-256 ccada7fc44e89bb9159fffad93b963298588eb9d6e27e0813ca774b70e85ef00

See more details on using hashes here.

Provenance

The following attestation bundles were made for treedump-0.2.0-py3-none-any.whl:

Publisher: python-publish.yml on appfeat/treedump

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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