Skip to content

vunholy/tree-for-windows

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tree-for-windows

A fast, colorful, feature-rich Windows command-line tree utility written in C++20 using std::filesystem.

📁 .
├── 📁 src
│   └── 📄 main.cpp
├── 📄 .gitignore
├── 📄 LICENSE
├── 📄 Makefile
├── 📄 README.md
└── 📄 cc.py

Features

  • 🎨 Colorful output - Customizable colors using native Windows console API
  • 📁 Unicode icons - Beautiful icons for directories (📁), files (📄), and symlinks (🔗)
  • 🚫 Smart filtering - .gitignore support and automatic hiding of common system folders
  • ⚙️ Persistent config - Save your preferences with --set-config
  • 🎯 Flexible options - Control depth, ignore patterns, colors, and more
  • Fast & efficient - Built with C++20 and optimized compilation
  • 🛡️ Robust - Handles permission errors and edge cases gracefully

Installation

Prerequisites

  • clang++ (via LLVM installer or MinGW-w64)
  • Windows 10/11

Build

make

This makes a build directory, Then you need to do:

# Balanced for speed & size
make

# Optimized for Tiny size
make tiny

# Optimized for max speed
make fast

This compiles src/main.cpp into build/tree.exe with C++20 optimizations.

Usage

tree [path] [options]

Options

Option Description
path Root directory to list (default: current directory)
--depth=N Limit recursion depth to N levels (default: unlimited)
--gitignore Skip files/folders matching .gitignore patterns
--ignore=folder1,folder2 Ignore specific folders or files
--show-hidden Show .git and other hidden system folders
--color=COLOR Set directory color: cyan, yellow, blue, magenta, red
--set-config [options] Save options as defaults for future use
--help, -h Show help message

Examples

Basic usage:

tree

Limit depth:

tree --depth=3

Use gitignore filtering:

tree --gitignore

Custom color:

tree --color=yellow

Ignore specific folders:

tree --ignore=node_modules,dist,.vscode

Show hidden folders:

tree --show-hidden --gitignore

Save your preferences:

# Set defaults once
tree --set-config --gitignore --color=cyan --depth=5

# Now tree uses these defaults every time
tree

# Override when needed
tree --depth=2 --color=yellow

Clear saved config:

tree --set-config

Default Behavior

By default, tree automatically hides common system and build folders:

  • .git
  • .cache
  • node_modules
  • .vscode
  • .idea
  • __pycache__

Use --show-hidden to display these folders.

Configuration

Your preferences are saved to %APPDATA%\.tree-for-windows\config.txt when using --set-config.

Command-line options always override saved configuration.

License

This project is licensed under the Apache License 2.0. See LICENSE for details.

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.


Made with ❤️ for Windows developers who want a better tree command.

About

Windows' default tree command is either ugly or terrible, And If you have gitbash then you have no tree command, So I decided to make my own and share it :)

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages

  • C++ 82.2%
  • Makefile 11.6%
  • Python 6.2%