Skip to main content

Directory content dumping utility

Project description

rootdump

PyPI version Python Versions License: MIT

A Python library for dumping directory contents into a single organized text file. Perfect for code reviews, documentation, and project analysis.

Features

Tree Structure - Displays directory structure in a tree format
📝 Content Dump - Dumps the content of all text files
🔍 Extension Filtering - Filter files by extension
Binary Detection - Automatically excludes binary files
🔢 Line Numbers - Includes line numbers with a separator for easy reading
🚫 Ignore Patterns - Supports .gitignore-style pattern matching for excluding files and directories

Installation

pip install rootdump

Quick Start

Command Line Usage

Basic usage:

rootdump /path/to/source output.txt

With options:

# Exclude binary files
rootdump /path/to/source output.txt --exclude-binary

# Include only specific extensions
rootdump /path/to/source output.txt --extensions .py .txt .md

# Skip directory tree structure
rootdump /path/to/source output.txt --no-tree

# Exclude line numbers from the output
rootdump /path/to/source output.txt --no-line-numbers

# Use ignore patterns file
rootdump /path/to/source output.txt --ignore-file .dumpignore

Ignore Patterns

Create a .dumpignore file to exclude specific files and directories. The syntax is similar to .gitignore:

# Ignore specific directories
node_modules/
.git/
tests/

# Ignore file patterns
*.pyc
*.log
.DS_Store

# Ignore specific files
config.json
secrets.yaml

Python API

from rootdump import dump_directory

# Basic usage
dump_directory("source_dir", "output.txt")

# With options
dump_directory(
    "source_dir",
    "output.txt",
    exclude_binary=True,
    include_extensions=[".py", ".txt"],
    show_tree=True,
    show_line_numbers=True,
    ignore_file=".dumpignore"  # Use ignore patterns file
)

Output Example

# Directory structure:
# .
# ├── src/
# │   ├── __init__.py
# │   └── main.py
# ├── tests/
# │   └── test_main.py
# └── README.md

## src/__init__.py

1 | def hello():
2 |     print("Hello from src/__init__.py")

## src/main.py

1 | def main():
2 |     print("Hello from src/main.py")
3 |
4 | if __name__ == "__main__":
5 |     main()

Contributing

Contributions are welcome! Feel free to:

  • Report issues
  • Suggest features
  • Submit pull requests

Acknowledgments

This project was inspired by uithub.com's project structure visualization.

License

This project is licensed under the MIT License - see the LICENSE file 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

rootdump-1.0.0.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

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

rootdump-1.0.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file rootdump-1.0.0.tar.gz.

File metadata

  • Download URL: rootdump-1.0.0.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.1

File hashes

Hashes for rootdump-1.0.0.tar.gz
Algorithm Hash digest
SHA256 16f721988ef6f4842c870f57a7e1717be597b0b87dc7faf25273cc02cba808bb
MD5 56b9f7dc9a148a6b34177207e5fe5926
BLAKE2b-256 e50a4c2c01131d8526282476dffc6b17cae5a98acf45be21bf6b637bb9f02b13

See more details on using hashes here.

File details

Details for the file rootdump-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: rootdump-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.1

File hashes

Hashes for rootdump-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51207e24e498459ce00629ef38515d88ba03c947213caaa53f9422e5de66d0f3
MD5 fe89558a7ea2f93f4049dc58aa8d235b
BLAKE2b-256 06e22a16fc73b86038e0ebcae70b40018ec0627bf0b5eb941672b3b0d0d18c3a

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