Skip to main content

count_files_with_progress

Function count_files_with_progress 

Source
pub fn count_files_with_progress<F>(path: &Path, on_progress: F) -> u64
where F: Fn(u64),
Expand description

Count files in a directory with progress callback.

The callback is invoked every 100 files with the current count. This allows updating a progress display during enumeration of large directories.

  • If path is a file: returns 1
  • If path is a directory: returns count of all files recursively
  • If path doesn’t exist or is a symlink: returns 0

§Arguments

  • path - Path to count files in
  • on_progress - Callback invoked every 100 files with current count

§Returns

Total file count