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.5.0.tar.gz (8.9 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.5.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for gettree-2.5.0.tar.gz
Algorithm Hash digest
SHA256 41e1d5102a65083445c07fb4f436bf2042dac79d3c2478c66545e9691b609e35
MD5 ef45e60097fb686d62fd38e8426a7fd2
BLAKE2b-256 04f93139d0f8540766a6c94ead9a98cd525b666576d3a338d4b127d6b696fe68

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gettree-2.5.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e28b7014b5c609eca6a48247d169077aadcdeb9a4ca85ce571f8145fed98484
MD5 6c1c82a1eac7ab938d86dc4942a8b7a2
BLAKE2b-256 5a33bbf5ec1108acc7978b0664f0aaa90149e5fd0c436f5e44737844ef04778c

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