A lightweight and customizable command-line utility for generating beautiful directory tree structures directly from your terminal.
Tree Printer makes it easy to visualize project layouts, document repositories, create examples for documentation, and inspect filesystem structures with optional icons, metadata, filtering, sorting, and color themes.
- π³ Generate recursive directory trees
- π Display directories only
- ποΈ Show or hide hidden files
- π« Exclude files, directories, or file extensions
- π Limit recursion depth
- π€ Sort entries by:
- Name
- Size
- Last modified date
- π Display file size
- π Display modification timestamps
- π¨ Multiple color themes
- πΌοΈ Optional file and folder icons
- π Export output to text files
- π« Respect
.gitignore - β‘ Fast and lightweight
- π§ͺ Fully tested with pytest
- π Continuous Integration using GitHub Actions
pip install directory-tree-printergit clone https://github.com/AmirmasoudCS/Tree-Printer.git
cd Tree-Printer
pip install .Print the current directory
tp .Print another directory
tp path/to/projectPrint only directories
tp --dirs-onlyShow icons
tp --iconsShow file sizes
tp --sizeLimit depth
tp --max-depth 2Save output
tp --output tree.txttp .project
βββ src
β βββ main.py
β βββ utils.py
βββ README.md
βββ pyproject.toml
tp --iconsπ project
βββ π src
β βββ π main.py
β βββ π utils.py
βββ π README.md
βββ βοΈ pyproject.toml
tp --sizeREADME.md (5.8 KB)
main.py (4.2 KB)
config.py (831 B)
tp --modifiedREADME.md (2026-05-12 18:42)
main.py (2026-05-11 14:30)
tp --theme sunset| Option | Alias | Description |
|---|---|---|
--max-depth |
-md |
Limit recursion depth |
--show-hidden |
-sh |
Include hidden files |
--dirs-only |
-do |
Show only directories |
--exclude-dirs |
-ed |
Exclude directories |
--exclude-files |
-ef |
Exclude files |
--exclude-suffixes |
-es |
Exclude file extensions |
--sort |
-st |
Sort by name, size or modified |
--size |
-s |
Display file sizes |
--modified |
-m |
Display modified dates |
--icons |
-i |
Display icons |
--theme |
-th |
Select a color theme |
--no-color |
-nc |
Disable colored output |
--gitignore |
-gi |
Ignore files listed in .gitignore |
--output |
-o |
Write output to a file |
--version |
-v |
Show installed version |
Clone the repository
git clone https://github.com/AmirmasoudCS/Tree-Printer.gitInstall development dependencies
pip install -e ".[dev]"Run the test suite
pytestRun tests with coverage
pytest --cov=tree_printer --cov-report=term-missingBuild the package
python -m buildVerify the package
python -m twine check dist/*
βββ π images
β βββ πΌοΈ themeImage1.png
βββ π tests
β βββ π __init__.py
β βββ π test_cli.py
β βββ π test_formatter.py
β βββ π test_printer.py
βββ π tree_printer
β βββ π __init__.py
β βββ π cli.py
β βββ π config.py
β βββ π file_types.py
β βββ π formatter.py
β βββ π icons.py
β βββ π models.py
β βββ π printer.py
β βββ π themes.py
βββ π CHANGELOG.md
βββ βοΈ LICENSE
βββ π main.py
βββ βοΈ pyproject.toml
βββ π README.md
βββ π requirements-dev.txt
Future improvements include:
- Additional export formats
- Custom icon packs
- More color themes
- Configuration file support
- Improved Windows terminal support
- Performance improvements for very large directories
Suggestions and pull requests are always welcome.
Contributions, feature requests, and bug reports are welcome.
If you'd like to contribute:
- Fork the repository
- Create a feature branch
- Make your changes
- Run the test suite
- Submit a Pull Request
See CHANGELOG.md for release history.
This project is licensed under the MIT License.
See LICENSE for details.
