Thanks to visit codestin.com
Credit goes to lib.rs

51 releases (17 breaking)

Uses new Rust 2024

0.18.0 Oct 30, 2025
0.16.1 Aug 22, 2025
0.16.0 Jul 8, 2025
0.12.0 Feb 25, 2025
0.2.0 Mar 7, 2021

#633 in Filesystem

WTFPL license

48KB
640 lines

Dowser

docs.rs changelog
crates.io ci deps.rs
license contributions welcome

Dowser is a(nother) fast, recursive file-finding library for Rust, but it differs from walkdir and kin in a number of ways:

  • It is not limited to one root; any number of file and directory paths can be loaded and traversed en masse;
  • Symlinks are followed by default, but can be disabled using Dowser::without_symlinks;
  • Hidden paths and mount points are traversed like anything else;
  • Matching file paths are canonicalized and deduped before yielding;
  • Directory paths are automatically crawled but not yielded;

Example

Create a new instance using Dowser::default, then specify root paths to ignore and/or include with Dowser::without_path and Dowser::with_path, respectively.

From there, leverage your favorite Iterator trait methods to filter/collect the results.

use dowser::Dowser;
use std::path::PathBuf;

// Return all files under "/usr/share/man", and probably some from other places
// since some programs prefer to symlink their documentation.
let men: Vec::<PathBuf> = Dowser::default()
    .with_path("/usr/share/man")
    .collect();

// Same as above, but filtering paths as discovered so as to only keep the
// gzipped ones.
let men_gz: Vec::<PathBuf> = Dowser::default()
    .with_path("/usr/share/man")
    .filter(|p|
        p.extension().is_some_and(|ext| ext.eq_ignore_ascii_case("gz"))
    )
    .collect();

Example

All you need to do is chain Dowser::default with one or more of the following seed methods:

  • Dowser::with_path / Dowser::with_paths
  • Dowser::without_path / Dowser::without_paths

From there, you can apply any Iterator methods you want.

use dowser::Dowser;
use std::path::PathBuf;

// Return all files under "/usr/share/man".
let files1: Vec::<PathBuf> = Dowser::default()
    .with_path("/usr/share/man")
    .collect();

// Return only Gzipped files using callback filter.
let files1: Vec::<PathBuf> = Dowser::default()
    .with_path("/usr/share/man")
    .filter(|p|
        p.extension().is_some_and(|e| e.eq_ignore_ascii_case("gz"))
    )
    .collect();

Installation

Add dowser to your dependencies in Cargo.toml, like:

[dependencies]
dowser = "0.17.*"

Dependencies

~1MB
~17K SLoC