Parallel filesystem traversal for Rust
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Sebastian Thiel 891125eec7
Some checks failed
Rust / build-and-test (push) Has been cancelled
Merge pull request #46 from Byron/rewrite
prepare for  AI rewrite
2025-12-03 06:42:43 +01:00
.github/workflows run benchmarks on CI 2022-12-13 17:17:05 +01:00
benches Fix badges and update some formatting 2025-12-03 05:30:05 +01:00
examples add new 'count' example to count as fast as possible 2024-01-07 11:14:56 +01:00
src Switch version to indicate breakage. 2025-12-03 05:38:03 +01:00
tests Use gix-testtools to allow state reuse for directories and simpler testing 2025-12-03 06:06:04 +01:00
.gitignore Use gix-testtools to allow state reuse for directories and simpler testing 2025-12-03 06:06:04 +01:00
Cargo.toml Use gix-testtools to allow state reuse for directories and simpler testing 2025-12-03 06:06:04 +01:00
CHANGELOG.md Release jwalk v0.8.1 2022-12-15 13:32:17 +01:00
LICENSE tests and cleanup 2019-02-08 15:41:17 -05:00
README.md Fix badges and update some formatting 2025-12-03 05:30:05 +01:00

jwalk

Filesystem walk.

  • Performed in parallel using Rayon
  • Entries streamed in sorted order
  • Custom sort/filter/skip/state

Build Status Latest Version

Usage

Add this to your Cargo.toml:

[dependencies]
jwalk = "0.6"

Lean More: docs.rs/jwalk

Example

Recursively iterate over the "foo" directory sorting by name:

use jwalk::{WalkDir};

for entry in WalkDir::new("foo").sort(true) {
  println!("{}", entry?.path().display());
}

Inspiration

This crate is inspired by both walkdir and ignore. It attempts to combine the parallelism of ignore with walkdir's streaming iterator API. Some code and comments are copied directly from walkdir.

Why use this crate?

This crate is particularly good when you want streamed sorted results. In my tests it's about 4x walkdir speed for sorted results with metadata. Also this crate's process_read_dir callback allows you to arbitrarily sort/filter/skip/state entries before they are yielded.

Why not use this crate?

Directory traversal is already pretty fast. If you don't need this crate's speed then walkdir provides a smaller and more tested single threaded implementation.

This crate's parallelism happens at the directory level. It will help when walking deep file systems with many directories. It wont help when reading a single directory with many files.

Benchmarks

Benchmarks comparing this crate with walkdir and ignore.