Skip to main content

Enhanced directory tree visualization tool

Project description

treeout

A Python-based enhanced tree command that displays directory structures with additional features and customization options.

Prerequisites

  • Python 3.8 or higher
  • No additional dependencies required

Overview

treeout is a versatile command-line tool for visualizing directory structures. It provides more features than the standard Windows tree command and offers rich customization for project analysis, documentation, and file management.

Features

  • ๐Ÿ“‚ Detailed directory tree visualization
  • ๐ŸŽจ Colorized output with file type-based coloring
  • ๐Ÿ“ Optional file size display
  • ๐Ÿ•’ Optional timestamp information
  • ๐Ÿšซ Configurable ignore patterns
  • ๐Ÿ“Š Summary statistics
  • ๐ŸŒฒ Depth control

Installation

Install directly from PyPI:

pip install treeout

For local development, you can clone the repository:

git clone https://github.com/soulwax/treeout.git

Then install it from the repository root:

pip install -e . 

This installs the package as editable, creating a global treeout command while local changes are reflected immediately.

Usage

Basic tree view

treeout

Show with colors and file sizes

treeout -c -s

Show everything (including normally ignored directories)

treeout --show-all

Show with file sizes, timestamps, and statistics

treeout -c -s -t --stats

Command Line Options

Option Description
-d, --max-depth Maximum depth to traverse
-s, --size Show file sizes
-t, --time Show modification times
-c, --color Colorize output
--stats Show summary statistics
--no-color Disable color even if supported

Pattern Handling Options

Option Description
-i, --ignore-pattern Additional regex pattern to ignore
-I, --ignore-patterns File containing patterns to ignore
--no-ignore Disable default ignore patterns
--show-all Show all files (same as --no-ignore)

Default Ignored Patterns

The following patterns are ignored by default (can be disabled with --no-ignore):

  • .git - Git directory
  • .pytest_cache - Pytest cache
  • .mypy_cache - MyPy cache
  • __pycache__ - Python cache
  • node_modules - Node.js modules
  • .vscode - VSCode settings
  • .idea - IntelliJ settings
  • .vs - Visual Studio settings
  • .venv, venv, env, .env - Virtual environments
  • .tox - Tox testing
  • .coverage - Coverage data
  • .sass-cache - SASS cache
  • .next - Next.js build
  • dist - Distribution directories
  • build - Build directories
  • .*_cache - Any cache directory

Color Coding

When using the -c option, files are color-coded by type:

  • ๐Ÿ”ต Blue - Directories
  • ๐ŸŸข Green - Executable files (.exe, .sh, .py, etc.)
  • ๐ŸŸก Yellow - Symlinks
  • ๐Ÿ’  Cyan - Media files (images, audio, video)
  • ๐ŸŸฃ Magenta - Archives (.zip, .tar, etc.)
  • ๐Ÿ”ด Red - Special files (config files, json, etc.)

Output Example

Directory of D:\Project

โ”œโ”€โ”€โ”€README.md [2.5KB] [2024-01-24 15:30]
โ”œโ”€โ”€โ”€setup.py [1.2KB]
โ”œโ”€โ”€โ”€src
โ”‚   โ”œโ”€โ”€โ”€main.py
โ”‚   โ””โ”€โ”€โ”€utils
โ”‚       โ”œโ”€โ”€โ”€helper.py
โ”‚       โ””โ”€โ”€โ”€config.json
โ””โ”€โ”€โ”€tests
    โ””โ”€โ”€โ”€test_main.py

Summary:
Directories: 3
Files: 5
Total size: 15.7KB

Output Files

The command generates a tree.txt file in the root directory containing the tree structure. When using colors, the console output will be colored while the file output remains plain text for better compatibility.

Requirements

  • Python 3.8 or higher
  • No additional dependencies required

TODOs

High Priority

  • Rename and publish as a package on PyPI, modify script to be a CLI entry point
  • Add support for custom output formats (JSON, XML, YAML)
  • Add pattern support for file extensions (e.g., show only *.py files)
  • Allow specifying a start directory as command-line argument
  • Add file permission display option (Unix-style)
  • Support for .treeignore file in project root (similar to .gitignore)

Nice to Have

  • Add interactive mode with real-time directory navigation
  • Export to different formats (HTML, Markdown, PDF)
  • Add Git status integration (show modified/untracked files)
  • Support for custom color schemes via config file
  • Add search functionality with glob patterns
  • Add size comparison between different runs
  • Add progress bar for large directories
  • Add option for horizontal tree layout

Future Considerations

  • Add network share/remote filesystem support
  • Create GUI interface with collapsible tree
  • Add plugin system for custom file type handlers
  • Support for archive inspection (peek into zip/tar files)
  • Add multi-language support for output
  • Create system tray monitoring for directory changes

License

GPL-3.0 License, see LICENSE for details.

Credits

This project was inspired by the standard tree command and aims to provide a more feature-rich alternative for Windows users. Feel free to contribute or suggest new features to enhance the tool further.

Contact / Author

For issues, suggestions, or feedback, please contact the author at https://github.com/soulwax, or create a new issue on GitHub, or submit a pull request, any feedback is welcome.

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

treeout-0.9.0.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

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

treeout-0.9.0-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file treeout-0.9.0.tar.gz.

File metadata

  • Download URL: treeout-0.9.0.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for treeout-0.9.0.tar.gz
Algorithm Hash digest
SHA256 7e8c910cda6013afc19772dff6f76932ae87b83c41bca8818f7ab3813e40ed9d
MD5 019d11a218af1dfc4bc26aeafa4b9883
BLAKE2b-256 24b5eaeead503233026a64d999757d96ceda16913cc82986ebd51924c27b4f58

See more details on using hashes here.

File details

Details for the file treeout-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: treeout-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 21.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for treeout-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 982717b5ca067e0832a1189c9920a3577444e2c82fb300be80a6a770fca403ff
MD5 c636de625c467195d8575236b708a31e
BLAKE2b-256 109136f3c8c8e554646d27ebc4beb1e6c2b34b4228cb55e1c7611dad5fac3cf2

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