A blazing-fast Rust CLI tool for visualizing directory structures with emojis. Perfect for exploring project hierarchies, creating documentation, or piping to other tools.
✨ Fast - Written in Rust with optimizations for speed 🎨 Beautiful - Displays trees with emojis and hierarchy connectors 🔍 Flexible - Powerful filtering with regex patterns 📋 Clipboard - Copy trees directly to clipboard 📊 Stats - Get statistics about your directory structure ⏱️ Timeout - Never hang on large directories 🔗 Pipeable - Tree output goes to stdout, metadata to stderr
Binary is available in C:\cmds\stree.exe after building.
compile.bat # Build and install to C:\cmds# Show current directory structure
stree
# Recursive with folder names only
stree -r -nf
# Show PDFs in a directory
stree -r -fi ".*\.pdf$"
# Exclude node_modules and .git
stree -r -i "node_modules|\.git"
# Copy tree to clipboard
stree -r -c
# Get statistics
stree -r -sstree [OPTIONS]
OPTIONS:
-r, --recursive Recursive mode (all subdirectories)
-d, --dir <path> Root directory (default: current)
-i, --ignore <regex> Ignore by name
-ip, --ignore-path <regex> Ignore by full path
-fi, --filter <regex> Show only matching files
-fip, --filter-path <regex> Filter files by path
-nr, --no-root Don't show root folder
-nf, --no-files Folders only
-fo, --files-only Files only
-fp, --full-path Show relative paths
-fpr, --full-path-root Show paths with root
-fpa, --full-path-absolute Show absolute paths
-nl, --no-lines Remove tree connectors
-ni, --no-icons Remove emoji icons
-ml, --max-level <n> Limit depth (0 = unlimited)
-c, --clipboard Copy to clipboard
-co, --clipboard-only Copy without displaying
-ar, --align-right Right-align tree
-s, --stats Show statistics
-so, --stats-only Only statistics
-v, --void Empty folders only
-t, --timeout <sec> Timeout (0 = no limit, default: 5)
-li, --limit-items <n> Max items (0 = unlimited)
-h, --help Show help
stree -r C:\Users\YourName\Projects\MyProjectstree -r -fi ".*\.ts$"stree -r -nfstree -r -i "node_modules|\.git|target|dist"stree -r -s -t 10# Copy and display
stree -r -c
# Copy without displaying (silent)
stree -r -co
# Copy and show statistics
stree -r -c -s
# Copy with stats only (no tree display)
stree -r -co -sostree -r | your-commandThe tree goes to stdout and can be piped:
stree -r > output.txt
stree -r | grep "\.rs"Warnings, confirmations, and stats go to stderr and don't interfere with piping:
stree -r 2>/dev/null # Keep only tree
stree -r 2>&1 # Keep bothClipboard and stats flags are independent and can be combined freely:
# Tree only
stree -r # Display tree
# With clipboard
stree -r -c # Tree + clipboard copy
stree -r -co # Clipboard only (no tree display)
# With statistics
stree -r -s # Tree + stats
stree -r -so # Stats only (no tree display)
# Combined
stree -r -c -s # Tree + clipboard + stats
stree -r -co -s # Clipboard + stats (no tree)
stree -r -c -so # Clipboard + stats only
stree -r -co -so # Clipboard + stats only- Optimized binary: LTO, symbols stripped, no debuginfo
- Smart timeouts: Prevents hanging on huge directories
- Efficient filtering: Regex compiled once and reused
- Streaming output: Lines printed immediately
- Rust 1.85.0 or later
dev.bat -rcompile.batCreates C:\cmds\stree.exe
Regex Options:
- Case-insensitive matching
-i "node_modules|\.git"to ignore multiple patterns-fi ".*\.pdf$"to filter file types
Path Modes:
-fp: Relative path (e.g.,src/main.rs)-fpr: Path with root (e.g.,project/src/main.rs)-fpa: Absolute path (e.g.,C:\Users\name\project\src\main.rs)
Display Order:
- Folders before files
- Alphabetically sorted within each group
Statistics Include:
- Total lines, folders, files
- Root-level items count
- Leaf folders (no subdirectories)
- Empty folders count
- Execution time
Full tree is copied even when:
- Timeout is reached
- Item limit is exceeded
- Tree is not displayed (
-co)
Ported from PowerShell for:
- Performance: ~100x faster
- Portability: Single executable
- Simplicity: No runtime dependencies
- Optimization: Full LTO and stripping
Use stree -h for help.