Function remove_files

Source
pub(crate) fn remove_files(paths: &[impl AsRef<Path>]) -> Result<(), Error>
Expand description

Attempts to remove all files in the specified slice with batch error handling.

Unlike std::fs::remove_file which stops at the first error, this function attempts to remove all specified files and collects all encountered errors. This is useful for cleanup operations where partial success is acceptable.

§Arguments

  • paths - Slice of file paths to attempt removal on

§Returns

  • Ok(()) if all files were successfully removed or if the input was empty
  • Err(anyhow::Error) containing an error encountered during removal attempt

§Logging

  • Logs successful removals at debug level
  • Logs individual file removal errors at error level