hash_file_list

Function hash_file_list 

Source
pub fn hash_file_list() -> FileList
Expand description

Calculate hashes for a list of files from a text file.

This function reads a list of file paths from the specified text file, calculates MD5 hashes for the contents of each file, and returns a FileList struct containing the date of the operation and a vector of FileInfo entries.

Only files not starting with ‘/sys/’, ‘/dev/’, ‘/run/’, or ‘/proc/’ are included in the hash calculation process.

§Arguments

  • filename - The path to the text file containing the list of file paths to hash.

§Returns

A FileList struct containing the date and a vector of FileInfo entries.

§Examples

use file_integrity::{hash_file_list, FileList};

let file_list = hash_file_list(); // hashs file_list.txt by defalt if no ags given
println!("Date: {}", file_list.date);
println!("Number of Files: {}", file_list.files.len());

§Errors

This function can return an error if the file cannot be opened or read, or if there are issues reading lines from the file.