Tired of using complicated external tree packages with too many options and complicated syntax? Try wintree - a fast, simple and easy to use alternative to built-in and third party tree commands for all operating systems.
wintreeis a simple, cross-platform command-line tool for generating directory tree listings. Written in Go, it provides a single, dependency-free binary that runs on Windows, macOS, and Linux. It's designed to be fast, intuitive, and simple, focusing on the most essential features like advanced filtering and easy output redirection.
- ⚡ Fast & Performant: Built with Go and efficiently skips large, unwanted directories like
.gitandnode_modules. - 💻 Cross-Platform: A single binary for Windows, macOS, and Linux.
- ✅ Simple Syntax: Intuitive flags that can be used in any order.
- 🔍 Powerful Filtering:
- Exclude: Easily ignore specific directories (
node_modules), file extensions (.log), or patterns. - Include: Use glob patterns (
*.go,*config*) to create a whitelist of files to display.
- Exclude: Easily ignore specific directories (
- 📋 Flexible Output:
- Print to the console (default).
- Save the output to a file (
--out). - Copy the output directly to the system clipboard (
--copy).
There are two easy ways to install wintree.
This is the easiest way to get wintree without needing Go installed.
- Go to the Latest Release page.
- Download the archive for your operating system and architecture (e.g.,
wintree_Windows_x86_64.ziporwintree_Darwin_arm64.tar.gz). - Extract the
wintree(orwintree.exe) binary. - Move the binary to a location in your system's
PATH(e.g.,/usr/local/binon macOS/Linux orC:\Windows\System32on Windows) to make it runnable from anywhere.
If you have Go installed, you can build and install wintree with a single command:
go install [github.com/maxdribny/wintree@latest](https://github.com/maxdribny/wintree@latest)wintree [path] [flags][path]: The directory to start the tree from. Defaults to the current directory (.) if omitted.
| Flag | Shorthand | Description | Example |
|---|---|---|---|
--exclude <str> |
-e |
Exclude directories or extensions. Can be used multiple times. | -e .git -e .log |
--include <glob> |
-i |
Whitelist files using glob patterns. Can be used multiple times. | -i "*.go" -i "Makefile" |
--out <file> |
-o |
Write the output to the specified file instead of the console. | -o my_tree.txt |
--copy |
-c |
Copy the final output tree to the system clipboard. | -c |
--smart-defaults |
-s |
Apply smart defaults based on detected project type. | -s |
--show-patterns |
-p |
Show a guide for using glob patterns. | -p |
--full-path |
-f |
Show the full directory path above the tree output. (Default = enabled) | -f to toggle |
--filepath |
Show only the full filepath of the specified path without tree. | --filepath /path/to/file |
|
--depth <int> |
-d |
Set maximum depth of directory tree (-1 for unlimited). | -d 3 |
--version |
-v |
Show version information. | -v |
--help |
-h |
Show the help message. | --help |
Generate a tree from the current directory.
wintreeList all files in your project, but ignore the .git directory and all .tmp files.
wintree . --exclude .git --exclude .tmpOnly show Go source files and markdown files.
wintree --include "*.go" --include "*.md"Show all Go files, but ignore test files.
wintree --include "*.go" --exclude "*_test.go"Display the absolute path of the directory being visualized above the tree output. This is now enabled by default.
# Full path is shown by default
wintree
# Disable full path display (show only base directory name)
wintree --no-full-pathGet only the absolute filepath of a specific file or folder without tree traversal.
# Get the absolute path of a folder
wintree --filepath ./src
# Get the absolute path of a file
wintree --filepath ./main.go
# Output example:
# C:\Users\Max\Programming\project\srcNote: The --filepath flag cannot be used with --depth, --exclude, --include, --copy, or --out flags.
Limit how deep the tree goes into subdirectories.
# Show only immediate children.
wintree --depth 1
# Show up to 3 levels deep.
wintree --depth 3
# Show entire tree (unlimited depth).
wintree --depth -1Generate a tree of your src folder and save it to docs/directory-structure.txt.
wintree ./src --out docs/directory-structure.txtGenerate a tree of the current directory, excluding node_modules, and copy it to the clipboard to easily paste into a document or message.
wintree -e node_modules -cApply intelligent filtering based on the detected project type. This automatically excludes common build artifacts, dependency directories, and temporary files.
wintree --smart-defaultsSupported project types:
- Go: Excludes
vendor,*.exe,*.dll,*.so,*.dylib - Node.js/JavaScript: Excludes
node_modules,dist,build,.next,coverage,*.log - Python: Excludes
__pycache__,*.pyc,venv,.env,pip-log.txt - Rust: Excludes
target,Cargo.lock - Java: Excludes
target,build,*.class,*.jar - And many more...
All project types automatically exclude .git, .DS_Store, and Thumbs.db.
Get a comprehensive guide on using glob patterns:
wintree --show-patternsIf you want to contribute to development:
git clone https://github.com/maxdribny/wintree.gitcd wintreego build .This section covers the development workflow for contributing to wintree.
- Go 1.21 or later
- Git
- PowerShell (windows) or Bash (macOS/Linux)
# Clone the repository
git clone https://github.com/maxdribny/wintree.git
cd wintree
# Create a feature branch
git checkout -b feature/your-feature-nameThe project structure:
cmd/- Core application logicroot.go- Main command implementationroot_test.go- Unit testsintegration_test.go- Integration testsbenchmark_test.go- Performance benchmarks
main.go- Entry point
Always run tests before committing:
# Run all tests
go test -v ./...
# Run specific test
go test -v -run TestBuildTreeOutput_WithFullPath ./cmd
# Run with coverage (PowerShell)
go test "-coverprofile=coverage.out" ./cmd
# Run with coverage (macOS/Linux)
go test -coverprofile=coverage.out ./cmd
go tool voer -html=coverage.out # View in browserTrack performance of your changes:
# Run All Benchmarks - Windows (PowerShell)
./run-benchmarks.ps1
# macOS/Linux
go test -bench=. -benchmem -count=5 ./cmdCompare performance before and after changes in your code:
# Before changes - Windows (PowerShell)
go test "-bench=." -count=10 ./cmd > benchmarks/before.txt
# macOS/Linux
go test -bench=. -count=10 ./cmd > benchmarks/before.txt
# After changes - Windows (PowerShell)
go test "-bench=." -count=10 ./cmd > benchmarks/after.txt
# macOS/Linux
go test -bench=. -count=10 ./cmd > benchmarks/after.txt
# Install benchstat and compare
go install golang.org/x/perf/cmd/benchstat@latest
benchstat benchmarks/before.txt benchmarks/after.txt# Build for local testing
go build .
./wintree --help
# Or use the build script (Windows only)
./build-local.ps1
# Test your changes manually
./wintree --full-path --depth 3
./wintree -f -e node_modules -i "*.go"# Format code
go fmt ./...
# Run go vet
go vet ./...# Stage changes
git add -a
# Commit with descriptive message
git commit -m "feat: add full-path flag to display absolute directory path"
# Push to your fork
git push origin feature/your-feature-name-
Click "New Pull Request"
-
"Select your feature branch"
-
Provide a clear description of changes
-
Reference any related issues
For mainters creating a new release:
# 1. Ensure all tests pass
go test -v ./...
# 2. Update version in code if needed
# 3. Build release artifacts
./build-release.ps1 -Version v[version]
# 4. Create and push tag
git tag v0.4.0
git push origin v0.4.0
# 5. Create github release
# - Upload the .zip files from dist/
# - Add release notesWe track performance over time. When making changes:
-
Run benchmarks before your changes
-
Make your changes
-
Run benchmarks after
-
Include benchmark comparison in PR if significant changes
Benchmark results are stored in benchmarks/ for historical comparison.
Contributions are welcome! If you find a bug or have a feature request, please open an issue. If you'd like to contribute code, please feel free to fork the repository and open a pull request.
Code Style Guidelines:
-
Use meaningful variable names
-
Add comments for complex logic
-
Keep functions focused and small
-
Write tests for new functionality
-
Include documentation for user-facing changes in PRs
This project is licensed under the MIT License. See the LICENSE file for details.