self.infos.errors.push("Failed to create file ".to_string()+file_name.as_str());
return;
}
};
matchfile.write_all(b"Results of searching\n\n"){
Ok(_)=>(),
Err(_)=>{
self.infos.errors.push("Failed to save results to file ".to_string()+file_name.as_str());
return;
}
}
if!self.files_with_identical_size.is_empty(){
file.write_all(b"-------------------------------------------------Files with same size-------------------------------------------------\n").unwrap();
file.write_all(("Found ".to_string()+self.infos.number_of_duplicated_files_by_size.to_string().as_str()+" duplicated files which in "+self.files_with_identical_size.len().to_string().as_str()+" groups.\n").as_bytes())
file.write_all(b"-------------------------------------------------Files with same hashes-------------------------------------------------\n").unwrap();
file.write_all(("Found ".to_string()+self.infos.number_of_duplicated_files_by_size.to_string().as_str()+" duplicated files which in "+self.files_with_identical_hashes.len().to_string().as_str()+" groups.\n").as_bytes())
println!("Number of checked files - {}",self.infos.number_of_checked_files);
println!("Number of checked folders - {}",self.infos.number_of_checked_folders);
println!("Number of ignored files - {}",self.infos.number_of_ignored_files);
println!("Number of ignored things(like symbolic links) - {}",self.infos.number_of_ignored_things);
println!("Number of duplicated files - {}",self.infos.number_of_duplicated_files);
letmutfile_size: u64=0;
foriin&self.files_with_identical_size{
file_size+=i.1.len()asu64;
}
println!("Files list size - {} ({})",self.files_with_identical_size.len(),file_size);
letmuthashed_file_size: u64=0;
foriin&self.files_with_identical_hashes{
forjini.1{
hashed_file_size+=j.len()asu64;
}
}
println!("Hashed Files list size - {} ({})",self.files_with_identical_hashes.len(),hashed_file_size);
println!("Number of duplicated files by size(in groups) - {} ({})",self.infos.number_of_duplicated_files_by_size,self.infos.number_of_groups_by_size);
println!("Number of duplicated files by hash(in groups) - {} ({})",self.infos.number_of_duplicated_files_by_hash,self.infos.number_of_groups_by_hash);
println!("Lost space by size - {} ({} bytes)",self.infos.lost_space_by_size.file_size(options::BINARY).unwrap(),self.infos.lost_space_by_size);
println!("Lost space by hash - {} ({} bytes)",self.infos.lost_space_by_hash.file_size(options::BINARY).unwrap(),self.infos.lost_space_by_hash);
println!("Gained space by removing duplicated entries - {} ({} bytes)",self.infos.gained_space.file_size(options::BINARY).unwrap(),self.infos.gained_space);
println!("Number of removed files - {}",self.infos.number_of_removed_files);
println!("Number of failed to remove files - {}",self.infos.number_of_failed_to_remove_files);
println!("Lost space - {} ({} bytes)",self.infos.lost_space.file_size(options::BINARY).unwrap(),self.infos.lost_space);
println!("Gained space by removing duplicated entries - {} ({} bytes)",self.infos.gained_space.file_size(options::BINARY).unwrap(),self.infos.gained_space);
println!("### Other");
println!("Files list size - {}",self.files_with_identical_size.len());
println!("Hashed Files list size - {}",self.files_with_identical_hashes.len());