treewalk 0.1.4

Common utilities for exploring a file tree
Documentation
  • Coverage
  • 61.29%
    19 out of 31 items documented3 out of 16 items with examples
  • Size
  • Source code size: 17.59 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 481.21 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 8s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • paytonward6/treewalk
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • paytonward6

treewalk

Common utilities for exploring a file tree

Example usage

    use std::path::{Path, PathBuf};
    use treewalk::walk::{comparison, lineage, format, utils};

    fn main() {
        let path = Path::new("./foo/bar");
        let children: Vec<PathBuf> = lineage::get_all_children(&path.to_path_buf()).unwrap();

        // or create children from strings via
        let children_from_strs = utils::tree!["./this_file.txt", "./that_file.txt"];

        // get the largest file
        let largest = comparison::largest_file(&children);
        if let Some(file_name) = &largest.name {
            println!("{:?}: {:?}", file_name, format::human_readable(largest.size, false));
        }

        // get only dotfiles
        let dotfiles: Vec<PathBuf> = children
            .into_iter()
            .filter(|path| comparison::is_dotfile(path))
            .collect();
        println!("{:?}", dotfiles);

    }