diff --git a/czkawka_cli/src/main.rs b/czkawka_cli/src/main.rs index fe8bb3f..4a5667e 100644 --- a/czkawka_cli/src/main.rs +++ b/czkawka_cli/src/main.rs @@ -148,7 +148,6 @@ fn main() { } df.get_text_messages().print_messages(); - //print_information(df.get_information()); } "--h" | "--help" => { print_help(); @@ -162,6 +161,13 @@ fn main() { println!("FATAL ERROR: Parameter -i with set of included files is required."); process::exit(1); } + + if ArgumentsPair::has_command(&arguments, "-delete") { + ef.set_delete_folder(true); + } + + ef.find_empty_folders(); + #[allow(clippy::collapsible_if)] if ArgumentsPair::has_command(&arguments, "-f") { if !ef.save_results_to_file(&ArgumentsPair::get_argument(&arguments, "-f", false)) { @@ -170,12 +176,6 @@ fn main() { } } - if ArgumentsPair::has_command(&arguments, "-delete") { - ef.set_delete_folder(true); - } - - ef.find_empty_folders(); - ef.print_empty_folders(); } argum => { diff --git a/czkawka_core/src/duplicate.rs b/czkawka_core/src/duplicate.rs index 4ac11a7..a1978aa 100644 --- a/czkawka_core/src/duplicate.rs +++ b/czkawka_core/src/duplicate.rs @@ -481,7 +481,7 @@ impl DuplicateFinder { } }; - match file.write_all(b"Results of searching\n\n") { + match file.write_all(format!("Results of searching in {:?}\n",self.included_directories).as_bytes()) { Ok(_) => (), Err(_) => { self.text_messages.errors.push("Failed to save results to file ".to_string() + file_name.as_str()); diff --git a/czkawka_core/src/empty_folder.rs b/czkawka_core/src/empty_folder.rs index c8a20dd..bea9d38 100644 --- a/czkawka_core/src/empty_folder.rs +++ b/czkawka_core/src/empty_folder.rs @@ -99,7 +99,7 @@ impl EmptyFolder { } }; - match file.write_all(b"Results of searching\n") { + match file.write_all(format!("Results of searching in {:?}\n",self.included_directories).as_bytes()) { Ok(_) => (), Err(_) => { self.text_messages.errors.push("Failed to save results to file ".to_string() + file_name.as_str()); @@ -139,6 +139,7 @@ impl EmptyFolder { } } self.empty_folder_list = new_directory_folders; + self.information.number_of_empty_folders = self.empty_folder_list.len(); } /// Function to check if folder are empty. @@ -177,6 +178,7 @@ impl EmptyFolder { let mut current_folder: String; let mut next_folder: String; while !folders_to_check.is_empty() { + self.information.number_of_checked_folders += 1; current_folder = folders_to_check.pop().unwrap(); // Checked folder may be deleted so we assume that cannot removed folder be empty let read_dir = match fs::read_dir(¤t_folder) {