Skip to main content

walk_files_multi

Function walk_files_multi 

Source
pub fn walk_files_multi(
    dir: &Path,
    extensions: &[&str],
) -> Result<Vec<PathBuf>, SsgError>
Expand description

Recursively collects files matching any of extensions under dir.

Extension matching is case-insensitive so IMG.JPG and img.jpg are both collected when extensions contains "jpg". Sorted output.

ยงExamples

use ssg::walk::walk_files_multi;
use tempfile::tempdir;
use std::fs;

let dir = tempdir().unwrap();
fs::write(dir.path().join("a.jpg"), "").unwrap();
fs::write(dir.path().join("B.PNG"), "").unwrap();
let imgs = walk_files_multi(dir.path(), &["jpg", "png"]).unwrap();
assert_eq!(imgs.len(), 2);