A fast, modern directory rtree viewer written in Rust with advanced filtering capabilities, parallel processing, and progress tracking.
- π Fast Parallel Processing - Multi-threaded directory scanning for large file systems
- π Advanced Filtering - Filter by file extensions, size, modification date, and regex patterns
- π Progress Tracking - Real-time progress bars for large directory scans
- πΎ Size Analysis - Human-readable file and directory sizes
- π¨ Colored Output - Beautiful rtree visualization with syntax highlighting
- π Symlink Support - Proper handling and display of symbolic links
- β‘ Smart Threading - Automatic parallelization based on directory size
git clone https://github.com/yourusername/rtree
cd rtree
cargo build --release
The binary will be available at target/release/rtree
.
cargo install --path .
# Basic usage
rtree /path/to/directory
# Show with progress and sizes
rtree /path/to/directory --progress --sizes
# Filter Rust files modified in last 7 days
rtree /path/to/project --ext rs --newer-than 7d
# Find configuration files
rtree /path/to/project --find config --progress
A modern directory rtree viewer with filtering capabilities
Usage: rtree [OPTIONS] <PATH>
Arguments:
<PATH> Directory path to display
Options:
-d, --depth <DEPTH> Maximum depth to traverse [default: 5]
-s, --sizes Show file and directory sizes
--ext <EXTENSIONS> Filter by file extensions (comma-separated, e.g., "rs,toml,md")
--min-size <SIZE> Minimum file size (e.g., "1MB", "500KB")
--max-size <SIZE> Maximum file size (e.g., "10MB", "1GB")
--newer-than <TIME> Show files newer than specified time (e.g., "7d", "2h", "30m")
--older-than <TIME> Show files older than specified time (e.g., "30d", "1h")
--include <PATTERN> Include files matching regex pattern
--exclude <PATTERN> Exclude files matching regex pattern
-f, --find <TERM> Search for files/directories containing this term
--dirs-only Show only directories
--files-only Show only files
-p, --progress Show progress bar during scanning
--no-parallel Disable parallel processing (use single thread)
-h, --help Print help
-V, --version Print version
1024
,1KB
,1K
β 1024 bytes1.5MB
,1.5M
β 1.5 megabytes2GB
,2G
β 2 gigabytes500
β 500 bytes (no unit)
7d
,7days
β 7 days ago2h
,2hours
β 2 hours ago30m
,30mins
β 30 minutes ago45s
,45secs
β 45 seconds ago -f, --find Search for files/directories containing term --ext Filter by file extensions (comma-separated) --min-size Minimum file size (e.g., "1MB", "500KB") --max-size Maximum file size (e.g., "10MB", "1GB") --newer-than Show files newer than specified time (e.g., "7d", "2h") --older-than Show files older than specified time (e.g., "30d", "1h") --include Include files matching regex pattern --exclude Exclude files matching regex pattern --dirs-only Show only directories --files-only Show only files -h, --help Print help -V, --version Print version
## Examples
### Basic rtree Display
```bash
# Simple rtree with default depth (5 levels)
rtree ~/Projects
# Custom depth
rtree ~/Projects --depth 3
# Show with file sizes
rtree ~/Projects --sizes --progress
# Show only Rust and TOML files
rtree ~/rust-project --ext rs,toml
# Show only source code files
rtree ~/project --include "\.(rs|js|py|go)$"
# Exclude build directories and files
rtree ~/project --exclude "(target|node_modules|\.git|\.DS_Store)"
# Find large files (>10MB)
rtree ~/Downloads --min-size 10MB --files-only
# Find small config files (<1KB)
rtree ~/configs --max-size 1KB --ext conf,ini,yaml
# Files between 1MB and 100MB
rtree ~/media --min-size 1MB --max-size 100MB
# Files modified in the last week
rtree ~/Documents --newer-than 7d
# Old log files (older than 30 days)
rtree ~/logs --older-than 30d --ext log
# Recent source code changes
rtree ~/project --newer-than 1d --ext rs,js,py
# Large Rust files modified recently
rtree ~/rust-project --ext rs --min-size 10KB --newer-than 3d --sizes
# Find test files in any language
rtree ~/project --include "test.*\.(rs|js|py)$" --progress
# Project overview excluding build artifacts
rtree ~/project --exclude "(target|build|dist|node_modules)" --depth 4 --sizes
rtree is designed for speed and can handle large directory structures efficiently:
- Parallel Processing: Automatically uses multiple CPU cores for large directories
- Smart Threading: Only parallelizes when beneficial (directories with >10 items)
- Progress Tracking: Real-time feedback for long-running scans
- Memory Efficient: Streams results without loading entire rtree into memory
On a typical development machine scanning a Rust project with ~50k files:
- Single-threaded: ~2.5 seconds
- Multi-threaded: ~0.8 seconds
- With filtering: ~0.3 seconds (when filters reduce result set)
rtree produces clean, readable output with:
- Directory Structure: Classic rtree-style indentation with Unicode characters
- Color Coding:
- π΅ Blue bold for directories
- π‘ Yellow highlighting for search matches
- π· Cyan for symbolic links
- Default for regular files
- Size Information: Human-readable sizes (B, KB, MB, GB, TB)
- Summary Statistics: Total item count and size when requested
Example output:
/home/user/rust-project (2.3 MB)
βββ Cargo.toml (1.2 KB)
βββ src/ (1.8 MB)
β βββ main.rs (15.4 KB)
β βββ lib.rs (2.1 KB)
β βββ modules/
β βββ scanner.rs (25.8 KB)
β βββ display.rs (18.3 KB)
βββ target/ (512.7 KB)
βββ debug/
βββ rtree (498.2 KB)
Total: 1,247 items
Size: 2.3 MB
rtree is built with a modular architecture for maintainability and extensibility:
src/
βββ main.rs # Entry point and orchestration
βββ lib.rs # Public API and module exports
βββ cli.rs # Command-line argument parsing
βββ filter.rs # File filtering logic
βββ item.rs # Core data structures
βββ scanner.rs # Directory traversal and parallel processing
βββ display.rs # rtree formatting and output
βββ progress.rs # Progress tracking and reporting
βββ utils.rs # Utility functions and helpers
- Scanner: High-performance parallel directory traversal using Rayon
- Filter: Flexible filtering system supporting multiple criteria
- Display: Clean rtree rendering with Unicode box-drawing characters
- Progress: Real-time progress reporting using Indicatif
- CLI: Professional command-line interface using Clap
- clap - Command line argument parsing
- rayon - Data parallelism for fast scanning
- indicatif - Progress bars and spinners
- colored - Terminal color output
- regex - Pattern matching for filtering
- anyhow - Error handling and context
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
git clone https://github.com/yourusername/rtree
cd rtree
cargo build
cargo test
# Run all tests
cargo test
# Run with output
cargo test -- --nocapture
# Run specific module tests
cargo test utils::tests
This project is licensed under the MIT License - see the LICENSE file for details.
- Export Options: JSON, XML, CSV output formats
- Interactive Mode: Navigate rtree with arrow keys
- Git Integration: Show git status indicators
- File Icons: Unicode icons based on file types
- Watch Mode: Monitor directory changes in real-time
- Configuration File: Save commonly used filter combinations
- Duplicate Detection: Find and highlight duplicate files
- Compression Analysis: Estimate potential space savings
- Inspired by the classic Unix
rtree
command - Built with modern Rust for performance and safety
- Uses Unicode box-drawing characters for clean output
Made with β€οΈ in Rust