Function cargo_util::du::du

source ·
pub fn du(path: &Path, patterns: &[&str]) -> Result<u64>
Expand description

Determines the disk usage of all files in the given directory.

The given patterns are gitignore style patterns relative to the given path. If there are patterns, it will only count things matching that pattern. ! can be used to exclude things. See [OverrideBuilder::add] for more info.

This is a primitive implementation that doesn’t handle hard links, and isn’t particularly fast (for example, not using getattrlistbulk on macOS). It also only uses actual byte sizes instead of block counts (and thus vastly undercounts directories with lots of small files). It would be nice to improve this or replace it with something better.