Skip to main content

Fast modern CLI to visualize folder structures with filtering, sorting, and JSON/CSV/Markdown exports

Project description

gettree

Modern tree CLI with ignore support, filtering, and exports



Overview

gettree is a fast CLI to visualize directory structures with:

  • ignore rules
  • filterings
  • sorting
  • multiple export formats

Install

pip install gettree

or

pip install git+https://github.com/ash-kernel/gettree.git

Usage

gettree [path] [options]

Quick Start

gettree .                              # Basic tree
gettree . --color --icons --stats      # With display options
gettree . --filter "\.py$"             # Filter files
gettree . --sort size --size           # Sort and show sizes
gettree . --json -o tree.json          # Export to JSON
gettree . --markdown -o tree.md        # Export to Markdown

Features

  • .gitignore + .gettreeignore + .dockerignore support
  • Regex filtering (--filter)
  • Sorting by name, size, or type
  • File size display + depth control
  • JSON / CSV / Markdown export
  • Statistics (files, folders, size, scan time)
  • Watch mode + Interactive TUI
  • Config file support (~/.config/gettree/config.toml)
  • Windows + Linux compatible

Options

Display:

  • --color, -c - Enable colored output
  • --icons - Show emoji icons
  • --size, -s - Display file sizes
  • --depth, -d N - Maximum traversal depth
  • --fullpath - Show absolute paths
  • --stats - Show summary statistics

Output Formats:

  • --json - Output as structured JSON
  • --csv - Export as CSV (use with -o)
  • --markdown - Wrap in markdown code block
  • --output, -o FILE - Save to file

Filtering & Sorting:

  • --filter, -f PATTERN - Filter by regex pattern
  • --sort TYPE - Sort by: name|size|type [default: name]
  • --ignore, -i PATTERN - Extra patterns to exclude

Ignore Rules:

  • --dockerignore - Include .dockerignore patterns (disabled by default)

Advanced:

  • --watch, -w - Watch mode (refresh every 2s)
  • --tui - Rich interactive tree view

Ignore Rules

Automatically loads and merges patterns from:

  • .gitignore - Standard git ignore rules (loaded by default)
  • .gettreeignore - Custom project-specific rules (loaded by default)
  • .dockerignore - Docker ignore rules (use --dockerignore to enable)

Example .gettreeignore

*.log
dist/
temp/
*.tmp

Configuration

Create ~/.config/gettree/config.toml to set defaults:

# Ignore Files
use_gitignore = true
use_gettreeignore = true
use_dockerignore = false

# Display Options
color = true       # Enable colors by default
icons = false      # Show icons by default
depth = null       # Max depth (null = unlimited)

Priority: CLI arguments > config file > built-in defaults

Setup:

mkdir -p ~/.config/gettree
touch ~/.config/gettree/config.toml

Then edit the config file with your preferred defaults.


Real-World Examples

View project structure:

gettree .
gettree . --depth 2

With visuals:

gettree . --color --icons --size --stats

Find all Python files:

gettree . --filter "\.py$" --color --icons

Export for documentation:

gettree . --markdown --depth 3 -o STRUCTURE.md
gettree . --json --stats -o structure.json

Monitor during development:

gettree . --watch --color --stats

Docker-aware tree:

gettree . --dockerignore --color --icons

Sort by file size (largest first):

gettree . --sort size --size --color --depth 2

Example Output

Project
├── 📁 src
│   ├── 🐍 main.py (2.3KB)
│   └── 🐍 utils.py (1.1KB)
├── 📁 tests
│   └── 🐍 test_main.py (890B)
├── 📝 README.md (5.6KB)
└── 📄 pyproject.toml (569B)

📊 Summary:
  Files: 4
  Folders: 2
  Total Size: 9.8KB
  Scan Time: 2.1ms

Performance

  • Small projects (<100 files): <5ms
  • Medium projects (<1000 files): 5-50ms
  • Large projects (>1000 files): 50-500ms

License

MIT


Author

ash-kernel - GitHub

Made with ❤️

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

gettree-2.0.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

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

gettree-2.0.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file gettree-2.0.0.tar.gz.

File metadata

  • Download URL: gettree-2.0.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for gettree-2.0.0.tar.gz
Algorithm Hash digest
SHA256 c5857c7d460a05dbb62c770ad5acbe9629b296b6154269df2ffe1ec0dd2fc024
MD5 90ddb64e51f2bb4df01d1badc8f67cd1
BLAKE2b-256 221aa7368c5c50adab967c640736201841663b662e85524203a2bd8474034fb7

See more details on using hashes here.

File details

Details for the file gettree-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: gettree-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for gettree-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 50965921a65d3decfa82c57a3b662aa8a63affb51032c8dfa9b343a89a162004
MD5 7b54f4568e24579b73426c61debc30b3
BLAKE2b-256 1dcb9cca73c022d615d8ae20dca7c82d32237f53e8fd70fd2af69702d741f73a

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