walkdir

A cross-platform Rust library for efficiently walking directory trees recursively

Library
Cargo
v2.5.0
1,552 stars
Unlicense

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
44 /100 Fair
Development Activity 12
Maintenance 0
Community 64
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
75 /100 Good
Architecture 80
Code Quality 78
Innovation 60
Learning Curve 82

walkdir is a Rust crate that provides an ergonomic, iterator-based API for recursively traversing a directory tree. It handles the platform-specific details of directory traversal on Unix and Windows, supports optional symbolic-link following, lets callers cap the number of simultaneously open file descriptors, and offers a filter_entry adapter for pruning whole subtrees (such as hidden directories) without paying the cost of descending into them.

Written and maintained by BurntSushi (author of ripgrep), walkdir is one of the most widely depended-upon crates in the Rust ecosystem for filesystem traversal, used as a building block by search tools, linters, build systems, and any application that needs to enumerate files under a root path.

What You Get

  • A WalkDir builder with a fluent API for configuring max depth, symlink following, sorting, and traversal order
  • A lazy Iterator of DirEntry results, so large trees can be processed incrementally without loading the whole tree into memory
  • A filter_entry() adapter that can skip descending into whole subtrees (e.g. hidden directories) without extra syscalls
  • Cross-platform behavior normalized between Unix and Windows, including consistent handling of file-descriptor limits
  • Well-defined error types so IO errors during traversal (permission denied, broken symlinks) surface as recoverable Results per entry

Common Use Cases

  • Building command-line search or grep-like tools that need to enumerate files under a directory efficiently
  • Implementing linters, formatters, or build tools that must discover all source files in a project tree
  • Writing backup, sync, or file-indexing utilities that walk large directory structures and need to skip specific subtrees
  • Any Rust application needing predictable, cross-platform recursive directory traversal instead of hand-rolled platform-specific code

Under The Hood

Architecture: The core of walkdir is src/lib.rs (roughly 1,200 lines), which implements WalkDir as a builder that produces an IntoIter/Iter pair driving a depth-first traversal using an explicit stack of open directory handles rather than recursion, which is what lets it bound the number of simultaneously open file descriptors (max_open) and avoid stack-overflow risk on very deep trees. src/dent.rs defines DirEntry, wrapping platform metadata (inode/file-type information) behind a uniform interface, and src/error.rs defines a dedicated Error type that preserves the path and IO cause so a single bad entry doesn’t abort the whole walk — it’s yielded as an Err in the iterator instead. Tech Stack: Pure Rust (2018 edition) with minimal dependencies — same-file for reliable file-identity comparisines across symlinks, and winapi-util gated behind cfg(windows) for Windows-specific file-handle APIs; the crate ships as a Cargo workspace including a small walkdir-list example binary. Code Quality: Tests live in src/tests/ alongside the implementation (declared via mod tests in lib.rs) and the crate has been stable at its core API for years with no unsafe code additions needed for the traversal logic itself; the README documents a manual performance-comparison methodology against find and glibc’s nftw, reflecting the author’s focus on measured, not assumed, performance parity. API Design: The builder-plus-iterator pattern (WalkDir::new("foo").follow_links(true).into_iter()) is idiomatic Rust and composes naturally with standard iterator adapters like filter_map and the crate’s own filter_entry, requiring almost no boilerplate to get a working recursive walk — the primary API surface is small enough to be fully learnable from the README’s four short examples.

Used by 21 apps in this directory

Rust
96%
Apache 2.0

InfluxDB

Analytics · Databases

31,779

Open-source time-series database built for real-time ingest, fast SQL queries, and embedded Python automation — powered by Apache Arrow and Parquet.

View details
80
Repo Health
76
Technical
72
Dependency
Built with
Rust 96%
Updated 1 weeks ago
Rust
56%
Other

Jan

AI Assistants

45,052

Run LLMs 100% locally with full privacy, or connect to cloud AI — your machine, your data, your control.

View details
90
Repo Health
81
Technical
65
Dependency
Built with
Rust 56%
TypeScript 40%
Updated 6 days ago
Rust
43%
Apache 2.0

LanceDB

AI Development · Databases

11,757

Open-source, embedded vector database built on the Lance columnar format for fast multimodal search across billions of vectors, backed by Y Combinator (W23).

View details
90
Repo Health
86
Technical
72
Dependency
Built with
Rust 43%
Python 27%
HTML 21%
Updated 6 days ago
JavaScript
55%
Other

Lokus

Knowledge Management · Note Taking

829

Local-first note-taking with graph view, canvas & AI plugins—your Markdown files, zero telemetry, blazing-fast Rust performance.

View details
75
Repo Health
75
Technical
64
Dependency
Built with
JavaScript 55%
HTML 21%
Rust 12%
Updated 2 months ago
Python
73%
AGPL 3.0

OpenViking

AI Development · AI Memory · Databases

40,705

An open-source context database that gives AI agents a unified filesystem for memory, resources, and skills with hierarchical tiered retrieval.

View details
85
Repo Health
75
Technical
64
Dependency
Built with
Python 73%
TypeScript 12%
Rust 11%
Updated 6 days ago
Rust
63%
MIT

PostgresML

AI Development · Databases

6,823

Run ML training and LLM inference natively inside PostgreSQL with GPU acceleration — no data movement required.

View details
51
Repo Health
76
Technical
64
Dependency
Built with
Rust 63%
JavaScript 11%
Updated 1 years ago
Python
55%
Other

PostHog

Ab Testing Experimentation · Analytics · Developer Tools

40,397

The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.

View details
92
Repo Health
80
Technical
65
Dependency
Built with
Python 55%
TypeScript 36%
Updated 6 days ago
Rust
63%
MIT

Readur

Bookmarks Archiving · File Storage · Knowledge Management

804

A self-hosted document management system that OCRs, indexes, and makes every PDF, scan, and Office file instantly searchable.

View details
83
Repo Health
78
Technical
67
Dependency
Built with
Rust 63%
TypeScript 32%
Updated 6 days ago
Rust
79%
AGPL 3.0

Spacedrive

Collaboration · File Storage

39,292

One file manager for all your devices and clouds — powered by a Virtual Distributed File System built in Rust.

View details
84
Repo Health
84
Technical
63
Dependency
Built with
Rust 79%
TypeScript 18%
Updated 2 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers