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
- ๐งฉ Custom color schemes via JSON
- ๐ Optional file size display
- ๐ Optional timestamp information
- ๐ Optional Unix-style permissions
- ๐งญ Optional Git status markers
- ๐ฆ Optional archive inspection for ZIP and TAR files
- ๐ซ Configurable ignore patterns
- ๐ฏ File extension filtering
- ๐ Glob-based file matching
- ๐ Text, JSON, XML, YAML, Markdown, and HTML output
- ๐งพ Size snapshots for comparing runs
- โณ Lightweight traversal progress reporting
- ๐ Summary statistics
- ๐ฒ Depth control and vertical or horizontal layouts
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
Show only Python and Markdown files
treeout -e py -e md
Show files matching glob patterns
treeout -g "test_*.py" -g "*.md"
Show Unix-style permissions
treeout -p
Show Git status markers
treeout --git-status
Use a custom color config
treeout -c --color-config treeout-colors.json
Example treeout-colors.json:
{
"file_colors": {
".py": "green",
".md": "cyan",
".json": "red"
}
}
Write JSON, YAML, XML, Markdown, or HTML
treeout --format json
treeout --format yaml -o project-tree.yaml
treeout --format html -o tree.html
Use a horizontal path layout
treeout --layout horizontal
Compare file sizes between runs
treeout --save-snapshot before.json
treeout --compare-snapshot before.json --save-snapshot after.json -s --stats
Peek inside archives
treeout --inspect-archives --archive-max-entries 20
Show traversal progress
treeout --progress
Command Line Options
| Option | Description |
|---|---|
-d, --max-depth |
Maximum depth to traverse |
-s, --size |
Show file sizes |
-t, --time |
Show modification times |
-p, --permissions |
Show Unix-style file permissions |
-c, --color |
Colorize output |
--color-config |
JSON file with custom extension color mappings |
--git-status |
Show Git status markers for tracked and untracked paths |
-e, --extension |
Only show files with this extension; repeat or comma-separate values |
-g, --glob |
Only show files matching this glob; repeat or comma-separate values |
-f, --format |
Output format: text, json, xml, yaml, markdown, or html |
--layout |
Layout style: vertical or horizontal |
--compare-snapshot |
Compare file sizes against a previous snapshot JSON file |
--save-snapshot |
Write a file-size snapshot JSON file for future comparison |
--inspect-archives |
Show entries inside supported .zip, .tar, .tar.gz, and .tgz archives |
--archive-max-entries |
Maximum archive entries to show per archive |
--progress |
Report visited directory count to stderr while generating 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) |
treeout also reads .treeignore from the target directory when default ignore handling is enabled. Patterns are regexes matched against each basename, the same as -i and -I.
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 cachenode_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.treeignore- Local treeout ignore file.sass-cache- SASS cache.next- Next.js builddist- Distribution directoriesbuild- 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.)
Custom color config files support these color names: blue, green, yellow, cyan, magenta, and red.
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 writes the tree to the target directory by default. Text output uses tree.txt; other formats use matching extensions such as tree.json, tree.yaml, tree.xml, tree.md, or tree.html. Override the path with -o.
When using colors, color is only applied to text console output.
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
.treeignorefile in project root (similar to .gitignore)
Nice to Have
- Add interactive mode with real-time directory navigation
- Export to HTML and Markdown
- Export to 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 soulwax: mail me; github user: URL TO or create a new issue o n GitHub, or submit a pull request, any feedback is welcome.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file treeout-0.9.1.tar.gz.
File metadata
- Download URL: treeout-0.9.1.tar.gz
- Upload date:
- Size: 29.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a2f7d6a46a8f6f5224b0b1165f9842c82ee0a0d13a89b254835c61a91c789f4
|
|
| MD5 |
0adc344e7db17ac4fb56ffac7327fd0b
|
|
| BLAKE2b-256 |
3d16383ca2da324a0c646714209ec383637f0226a6f9e88ec93bead895f6a722
|
File details
Details for the file treeout-0.9.1-py3-none-any.whl.
File metadata
- Download URL: treeout-0.9.1-py3-none-any.whl
- Upload date:
- Size: 27.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82ca3f02f378685f68c21e0b5fa9a64c9a19c79f24ebb9f00ba0d93bb297b263
|
|
| MD5 |
52581c2c52d7d681d216a731515049df
|
|
| BLAKE2b-256 |
e9ddee0703cc3a31bb93ccda0aec3b4ef03a7c7c72d1bed8e7f4c6c50fa8d8bb
|