rust-fd

Crates.iorust-fd
lib.rsrust-fd
version0.1.0
created_at2025-11-24 02:40:38.265403+00
updated_at2025-11-24 02:40:38.265403+00
descriptionA fast file finder written in Rust with glob pattern matching
homepage
repositoryhttps://github.com/atiyil/rust-fd
max_upload_size
id1947290
size15,301
ATILAY YILMAZ (atiyil)

documentation

README

rust-fd

A fast file finder written in Rust, inspired by fd.

Features

  • 🚀 Fast: Iterative directory traversal with no stack overflow on deep directories
  • 🔍 Pattern Matching: Glob pattern support (*.rs, file*, etc.)
  • 📁 Comprehensive: Finds files, directories, and symlinks
  • 🎯 Simple: Easy-to-use command-line interface
  • Tested: Handles edge cases (spaces in names, deep nesting, symlinks)

Installation

From Source

git clone https://github.com/atiyil/rust-fd.git
cd rust-fd
cargo build --release

The binary will be at target/release/rust-fd.

From Crates.io (Coming Soon)

cargo install rust-fd

Usage

Basic Examples

# Find all files and directories
rust-fd

# Find all Rust files
rust-fd "*.rs"

# Find all files starting with "test"
rust-fd "test*"

# Find files containing "config"
rust-fd "*config*"

Pattern Syntax

rust-fd uses glob patterns for matching:

  • * - Matches any sequence of characters
  • ? - Matches any single character
  • [abc] - Matches any character in the set
  • [!abc] - Matches any character not in the set

Note: Patterns are case-sensitive.

Examples

# Find all JavaScript and TypeScript files
rust-fd "*.js"
rust-fd "*.ts"

# Find all test files
rust-fd "*test*"

# Find README files
rust-fd "README*"

# Find all files (no pattern)
rust-fd

Performance

rust-fd uses an iterative approach with an explicit stack for directory traversal, which:

  • ✅ Prevents stack overflow on deeply nested directories
  • ✅ Handles hundreds of thousands of files efficiently
  • ✅ Uses constant call stack space

Tested on:

  • ✅ 100-level deep directory nesting
  • ✅ 500,000+ files without issues

Development

Running Tests

# Run the automated test suite
./test_pattern_matching.sh

# Or run with cargo
cargo test

Project Structure

rust-fd/
├── src/
│   └── main.rs           # Main implementation
├── test_cases/           # Test files and directories
├── test_pattern_matching.sh  # Test script
├── Cargo.toml
└── README.md

Roadmap

  • Iterative directory traversal
  • Glob pattern matching
  • Filter by file type (file/dir/symlink)
  • CLI argument parsing with clap
  • Ignore .gitignore patterns
  • Parallel directory traversal

Contributing

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

License

MIT License - see LICENSE for details.

Acknowledgments

Inspired by fd - a fast alternative to find.

Commit count: 0

cargo fmt