]> git.proxmox.com Git - rustc.git/blobdiff - vendor/fs_extra/tests/dir.rs
New upstream version 1.51.0+dfsg1
[rustc.git] / vendor / fs_extra / tests / dir.rs
index c744020f5e770e73fac20d0af8354e8a61d96a5e..bf0dfab04e61ac387ac26ff05f3b9db88e9d77be 100644 (file)
@@ -1,15 +1,13 @@
+use std::collections::HashSet;
+use std::fs::read_dir;
 use std::path::{Path, PathBuf};
-use std::thread;
 use std::sync::mpsc::{self, TryRecvError};
-use std::fs::read_dir;
-use std::collections::HashSet;
+use std::thread;
 
 extern crate fs_extra;
 use fs_extra::dir::*;
 use fs_extra::error::*;
 
-
-
 fn files_eq<P, Q>(file1: P, file2: Q) -> bool
 where
     P: AsRef<Path>,
@@ -18,10 +16,8 @@ where
     let content1 = fs_extra::file::read_to_string(file1).unwrap();
     let content2 = fs_extra::file::read_to_string(file2).unwrap();
     content1 == content2
-
 }
 
-
 fn compare_dir<P, Q>(path_from: P, path_to: Q) -> bool
 where
     P: AsRef<Path>,
@@ -64,11 +60,8 @@ where
     true
 }
 
-
 const TEST_FOLDER: &'static str = "./tests/temp/dir";
 
-
-
 #[test]
 fn it_create_all_work() {
     let mut test_dir = PathBuf::from(TEST_FOLDER);
@@ -118,19 +111,15 @@ fn it_create_exist_folder() {
 
     match create(&test_dir, false) {
         Ok(_) => panic!("Should be error!"),
-        Err(err) => {
-            match err.kind {
-                ErrorKind::AlreadyExists => {
-                    assert!(test_dir.exists());
-                    assert!(file_path.exists());
-                    let new_content = fs_extra::file::read_to_string(file_path).unwrap();
-                    assert_eq!(new_content, content);
-
-                }
-                _ => panic!("Wrong error"),
+        Err(err) => match err.kind {
+            ErrorKind::AlreadyExists => {
+                assert!(test_dir.exists());
+                assert!(file_path.exists());
+                let new_content = fs_extra::file::read_to_string(file_path).unwrap();
+                assert_eq!(new_content, content);
             }
-        }
-
+            _ => panic!("Wrong error"),
+        },
     }
 }
 
@@ -229,7 +218,6 @@ fn it_remove_not_exist() {
         }
         Err(err) => panic!(err.to_string()),
     }
-
 }
 
 #[test]
@@ -288,20 +276,18 @@ fn it_copy_not_folder() {
     fs_extra::file::write_all(&path_from, "test").unwrap();
 
     match copy(&path_from, &path_to, &options) {
-        Err(err) => {
-            match err.kind {
-                ErrorKind::InvalidFolder => {
-                    let wrong_path = format!(
-                        "Path \"{}\" is not a directory!",
-                        path_from.to_str().unwrap()
-                    );
-                    assert_eq!(wrong_path, err.to_string());
-                }
-                _ => {
-                    panic!("wrong error");
-                }
+        Err(err) => match err.kind {
+            ErrorKind::InvalidFolder => {
+                let wrong_path = format!(
+                    "Path \"{}\" is not a directory!",
+                    path_from.to_str().unwrap()
+                );
+                assert_eq!(wrong_path, err.to_string());
             }
-        }
+            _ => {
+                panic!("wrong error");
+            }
+        },
         Ok(_) => {
             panic!("should be error");
         }
@@ -322,21 +308,19 @@ fn it_copy_source_not_exist() {
 
     let options = CopyOptions::new();
     match copy(&path_from, &path_to, &options) {
-        Err(err) => {
-            match err.kind {
-                ErrorKind::NotFound => {
-                    let wrong_path = format!(
-                        "Path \"{}\" does not exist or you don't have \
-                                              access!",
-                        path_from.to_str().unwrap()
-                    );
-                    assert_eq!(wrong_path, err.to_string());
-                }
-                _ => {
-                    panic!(format!("wrong error {}", err.to_string()));
-                }
+        Err(err) => match err.kind {
+            ErrorKind::NotFound => {
+                let wrong_path = format!(
+                    "Path \"{}\" does not exist or you don't have \
+                     access!",
+                    path_from.to_str().unwrap()
+                );
+                assert_eq!(wrong_path, err.to_string());
             }
-        }
+            _ => {
+                panic!(format!("wrong error {}", err.to_string()));
+            }
+        },
         Ok(_) => {
             panic!("should be error");
         }
@@ -373,7 +357,6 @@ fn it_copy_exist_overwrite() {
     fs_extra::file::write_all(&file2_path, &content2).unwrap();
     assert!(file2_path.exists());
 
-
     let mut exist_path = path_to.clone();
     exist_path.push(&test_name);
     create(&exist_path, true).unwrap();
@@ -384,7 +367,6 @@ fn it_copy_exist_overwrite() {
     fs_extra::file::write_all(&exist_path, exist_content).unwrap();
     assert!(exist_path.exists());
 
-
     let mut options = CopyOptions::new();
     options.overwrite = true;
     copy(&path_from, &path_to, &options).unwrap();
@@ -428,17 +410,15 @@ fn it_copy_exist_not_overwrite() {
 
     let options = CopyOptions::new();
     match copy(&path_from, &path_to, &options) {
-        Err(err) => {
-            match err.kind {
-                ErrorKind::AlreadyExists => {
-                    let wrong_path = format!("Path \"{}\" is exist", exist_path.to_str().unwrap());
-                    assert_eq!(wrong_path, err.to_string());
-                }
-                _ => {
-                    panic!(format!("wrong error {}", err.to_string()));
-                }
+        Err(err) => match err.kind {
+            ErrorKind::AlreadyExists => {
+                let wrong_path = format!("Path \"{}\" is exist", exist_path.to_str().unwrap());
+                assert_eq!(wrong_path, err.to_string());
             }
-        }
+            _ => {
+                panic!(format!("wrong error {}", err.to_string()));
+            }
+        },
         Ok(_) => {
             panic!("should be error");
         }
@@ -475,7 +455,6 @@ fn it_copy_exist_skip_exist() {
     fs_extra::file::write_all(&file2_path, &content2).unwrap();
     assert!(file2_path.exists());
 
-
     let mut exist_path = path_to.clone();
     exist_path.push(&test_name);
     create(&exist_path, true).unwrap();
@@ -486,7 +465,6 @@ fn it_copy_exist_skip_exist() {
     fs_extra::file::write_all(&exist_path, exist_content).unwrap();
     assert!(exist_path.exists());
 
-
     let mut options = CopyOptions::new();
     options.skip_exist = true;
     copy(&path_from, &path_to, &options).unwrap();
@@ -532,7 +510,6 @@ fn it_copy_exist_overwrite_and_skip_exist() {
     fs_extra::file::write_all(&file2_path, &content2).unwrap();
     assert!(file2_path.exists());
 
-
     let mut exist_path = path_to.clone();
     exist_path.push(&test_name);
     create(&exist_path, true).unwrap();
@@ -543,7 +520,6 @@ fn it_copy_exist_overwrite_and_skip_exist() {
     fs_extra::file::write_all(&exist_path, exist_content).unwrap();
     assert!(exist_path.exists());
 
-
     let mut options = CopyOptions::new();
     options.overwrite = true;
     options.skip_exist = true;
@@ -556,8 +532,7 @@ fn it_copy_exist_overwrite_and_skip_exist() {
 }
 
 #[test]
-fn it_copy_using_first_levels(){
-
+fn it_copy_using_first_levels() {
     let test_dir = Path::new(TEST_FOLDER).join("it_copy_using_first_levels");
     let path_to = test_dir.join("out");
     let d_level_1 = (test_dir.join("d_level_1"), path_to.join("d_level_1"));
@@ -566,11 +541,11 @@ fn it_copy_using_first_levels(){
     let d_level_4 = (d_level_3.0.join("d_level_4"), d_level_3.1.join("d_level_4"));
     let d_level_5 = (d_level_4.0.join("d_level_5"), d_level_4.1.join("d_level_5"));
 
-    let file1 = (d_level_1.0.join("file1.txt"),d_level_1.1.join("file1.txt"));
-    let file2 = (d_level_2.0.join("file2.txt"),d_level_2.1.join("file2.txt"));
-    let file3 = (d_level_3.0.join("file3.txt"),d_level_3.1.join("file3.txt"));
-    let file4 = (d_level_4.0.join("file4.txt"),d_level_4.1.join("file4.txt"));
-    let file5 = (d_level_5.0.join("file5.txt"),d_level_5.1.join("file5.txt"));
+    let file1 = (d_level_1.0.join("file1.txt"), d_level_1.1.join("file1.txt"));
+    let file2 = (d_level_2.0.join("file2.txt"), d_level_2.1.join("file2.txt"));
+    let file3 = (d_level_3.0.join("file3.txt"), d_level_3.1.join("file3.txt"));
+    let file4 = (d_level_4.0.join("file4.txt"), d_level_4.1.join("file4.txt"));
+    let file5 = (d_level_5.0.join("file5.txt"), d_level_5.1.join("file5.txt"));
 
     create_all(&d_level_1.0, true).unwrap();
     create_all(&d_level_2.0, true).unwrap();
@@ -586,7 +561,6 @@ fn it_copy_using_first_levels(){
     assert!(d_level_4.0.exists());
     assert!(d_level_5.0.exists());
 
-
     assert!(!d_level_1.1.exists());
     assert!(!d_level_2.1.exists());
     assert!(!d_level_3.1.exists());
@@ -643,10 +617,8 @@ fn it_copy_using_first_levels(){
     assert!(files_eq(&file1.0, &file1.1));
 }
 
-
 #[test]
-fn it_copy_using_four_levels(){
-
+fn it_copy_using_four_levels() {
     let test_dir = Path::new(TEST_FOLDER).join("it_copy_using_four_levels");
     let path_to = test_dir.join("out");
     let d_level_1 = (test_dir.join("d_level_1"), path_to.join("d_level_1"));
@@ -655,11 +627,11 @@ fn it_copy_using_four_levels(){
     let d_level_4 = (d_level_3.0.join("d_level_4"), d_level_3.1.join("d_level_4"));
     let d_level_5 = (d_level_4.0.join("d_level_5"), d_level_4.1.join("d_level_5"));
 
-    let file1 = (d_level_1.0.join("file1.txt"),d_level_1.1.join("file1.txt"));
-    let file2 = (d_level_2.0.join("file2.txt"),d_level_2.1.join("file2.txt"));
-    let file3 = (d_level_3.0.join("file3.txt"),d_level_3.1.join("file3.txt"));
-    let file4 = (d_level_4.0.join("file4.txt"),d_level_4.1.join("file4.txt"));
-    let file5 = (d_level_5.0.join("file5.txt"),d_level_5.1.join("file5.txt"));
+    let file1 = (d_level_1.0.join("file1.txt"), d_level_1.1.join("file1.txt"));
+    let file2 = (d_level_2.0.join("file2.txt"), d_level_2.1.join("file2.txt"));
+    let file3 = (d_level_3.0.join("file3.txt"), d_level_3.1.join("file3.txt"));
+    let file4 = (d_level_4.0.join("file4.txt"), d_level_4.1.join("file4.txt"));
+    let file5 = (d_level_5.0.join("file5.txt"), d_level_5.1.join("file5.txt"));
 
     create_all(&d_level_1.0, true).unwrap();
     create_all(&d_level_2.0, true).unwrap();
@@ -675,7 +647,6 @@ fn it_copy_using_four_levels(){
     assert!(d_level_4.0.exists());
     assert!(d_level_5.0.exists());
 
-
     assert!(!d_level_1.1.exists());
     assert!(!d_level_2.1.exists());
     assert!(!d_level_3.1.exists());
@@ -735,7 +706,69 @@ fn it_copy_using_four_levels(){
     assert!(files_eq(&file3.0, &file3.1));
     assert!(files_eq(&file4.0, &file4.1));
 }
+#[test]
+fn it_copy_content_only_option() {
+    let test_dir = Path::new(TEST_FOLDER).join("it_copy_content_only_option");
+    let path_to = test_dir.join("out");
+    let d_level_1 = (test_dir.join("d_level_1"), path_to.clone());
+    let d_level_2 = (d_level_1.0.join("d_level_2"), d_level_1.1.join("d_level_2"));
+    let d_level_3 = (d_level_2.0.join("d_level_3"), d_level_2.1.join("d_level_3"));
 
+    let file1 = (d_level_1.0.join("file1.txt"), d_level_1.1.join("file1.txt"));
+    let file2 = (d_level_2.0.join("file2.txt"), d_level_2.1.join("file2.txt"));
+    let file3 = (d_level_3.0.join("file3.txt"), d_level_3.1.join("file3.txt"));
+
+    create_all(&d_level_1.0, true).unwrap();
+    create_all(&d_level_2.0, true).unwrap();
+    create_all(&d_level_3.0, true).unwrap();
+    create_all(&path_to, true).unwrap();
+
+    assert!(path_to.exists());
+    assert!(d_level_1.0.exists());
+    assert!(d_level_2.0.exists());
+    assert!(d_level_3.0.exists());
+
+    assert!(!d_level_2.1.exists());
+    assert!(!d_level_3.1.exists());
+
+    fs_extra::file::write_all(&file1.0, "content1").unwrap();
+    fs_extra::file::write_all(&file2.0, "content2").unwrap();
+    fs_extra::file::write_all(&file3.0, "content3").unwrap();
+
+    assert!(file1.0.exists());
+    assert!(file2.0.exists());
+    assert!(file3.0.exists());
+
+    assert!(!file1.1.exists());
+    assert!(!file2.1.exists());
+    assert!(!file3.1.exists());
+
+    let mut options = CopyOptions::new();
+    options.content_only = true;
+    let result = copy(&d_level_1.0, path_to, &options).unwrap();
+
+    assert_eq!(24, result);
+
+    assert!(d_level_1.0.exists());
+    assert!(d_level_2.0.exists());
+    assert!(d_level_3.0.exists());
+
+    assert!(d_level_1.1.exists());
+    assert!(d_level_2.1.exists());
+    assert!(d_level_3.1.exists());
+
+    assert!(file1.0.exists());
+    assert!(file2.0.exists());
+    assert!(file3.0.exists());
+
+    assert!(file1.1.exists());
+    assert!(file2.1.exists());
+    assert!(file3.1.exists());
+
+    assert!(files_eq(&file1.0, &file1.1));
+    assert!(files_eq(&file2.0, &file2.1));
+    assert!(files_eq(&file3.0, &file3.1));
+}
 
 #[test]
 fn it_copy_progress_work() {
@@ -780,7 +813,6 @@ fn it_copy_progress_work() {
         assert_eq!(15, result);
         assert!(path_to.exists());
         assert!(compare_dir(&path_from, &path_to));
-
     }).join();
 
     loop {
@@ -807,7 +839,6 @@ fn it_copy_progress_work() {
         Ok(_) => {}
         Err(err) => panic!(err),
     }
-
 }
 
 #[test]
@@ -834,27 +865,24 @@ fn it_copy_with_progress_not_folder() {
         TransitProcessResult::ContinueOrAbort
     };
     match copy_with_progress(&path_from, &path_to, &options, func_test) {
-        Err(err) => {
-            match err.kind {
-                ErrorKind::InvalidFolder => {
-                    let wrong_path = format!(
-                        "Path \"{}\" is not a directory!",
-                        path_from.to_str().unwrap()
-                    );
-                    assert_eq!(wrong_path, err.to_string());
-                }
-                _ => {
-                    panic!("wrong error");
-                }
+        Err(err) => match err.kind {
+            ErrorKind::InvalidFolder => {
+                let wrong_path = format!(
+                    "Path \"{}\" is not a directory!",
+                    path_from.to_str().unwrap()
+                );
+                assert_eq!(wrong_path, err.to_string());
             }
-        }
+            _ => {
+                panic!("wrong error");
+            }
+        },
         Ok(_) => {
             panic!("should be error");
         }
     }
 }
 
-
 #[test]
 fn it_copy_with_progress_work_dif_buf_size() {
     let mut path_from = PathBuf::from(TEST_FOLDER);
@@ -935,7 +963,6 @@ fn it_copy_with_progress_work_dif_buf_size() {
             Ok(_) => {}
             Err(err) => panic!(err),
         }
-
     }).join();
 
     for i in 1..9 {
@@ -979,21 +1006,19 @@ fn it_copy_with_progress_source_not_exist() {
         };
 
         match copy_with_progress(&path_from, &path_to, &options, func_test) {
-            Err(err) => {
-                match err.kind {
-                    ErrorKind::NotFound => {
-                        let wrong_path = format!(
-                            "Path \"{}\" does not exist or you don't \
-                                                      have access!",
-                            path_from.to_str().unwrap()
-                        );
-                        assert_eq!(wrong_path, err.to_string());
-                    }
-                    _ => {
-                        panic!(format!("wrong error {}", err.to_string()));
-                    }
+            Err(err) => match err.kind {
+                ErrorKind::NotFound => {
+                    let wrong_path = format!(
+                        "Path \"{}\" does not exist or you don't \
+                         have access!",
+                        path_from.to_str().unwrap()
+                    );
+                    assert_eq!(wrong_path, err.to_string());
                 }
-            }
+                _ => {
+                    panic!(format!("wrong error {}", err.to_string()));
+                }
+            },
             Ok(_) => {
                 panic!("should be error");
             }
@@ -1007,9 +1032,7 @@ fn it_copy_with_progress_source_not_exist() {
     match rx.recv() {
         Err(_) => {}
         _ => panic!("should be error"),
-
     }
-
 }
 
 #[test]
@@ -1059,10 +1082,8 @@ fn it_copy_with_progress_exist_overwrite() {
         assert_eq!(23, result);
         assert!(path_to.exists());
         assert!(compare_dir(&path_from, &path_to));
-
     }).join();
 
-
     match result {
         Ok(_) => {}
         Err(err) => panic!(err),
@@ -1071,9 +1092,7 @@ fn it_copy_with_progress_exist_overwrite() {
     match rx.recv() {
         Err(_) => panic!("Errors should not be!"),
         _ => {}
-
     }
-
 }
 
 #[test]
@@ -1119,14 +1138,11 @@ fn it_copy_with_progress_exist_not_overwrite() {
     let result = copy_with_progress(&path_from, &path_to, &options, func_test);
     match result {
         Ok(_) => panic!("Should be error!"),
-        Err(err) => {
-            match err.kind {
-                ErrorKind::AlreadyExists => {}
-                _ => panic!("Wrong wrror"),
-            }
-        }
+        Err(err) => match err.kind {
+            ErrorKind::AlreadyExists => {}
+            _ => panic!("Wrong wrror"),
+        },
     }
-
 }
 
 #[test]
@@ -1175,10 +1191,8 @@ fn it_copy_with_progress_exist_skip_exist() {
         assert_eq!(0, result);
         assert!(path_to.exists());
         assert!(!compare_dir(&path_from, &path_to));
-
     }).join();
 
-
     match result {
         Ok(_) => {}
         Err(err) => panic!(err),
@@ -1187,12 +1201,9 @@ fn it_copy_with_progress_exist_skip_exist() {
     match rx.recv() {
         Err(_) => {}
         _ => panic!("should be error"),
-
     }
-
 }
 
-
 #[test]
 fn it_copy_with_progress_exist_overwrite_and_skip_exist() {
     let mut path_from = PathBuf::from(TEST_FOLDER);
@@ -1241,21 +1252,17 @@ fn it_copy_with_progress_exist_overwrite_and_skip_exist() {
         assert_eq!(23, result);
         assert!(path_to.exists());
         assert!(compare_dir(&path_from, &path_to));
-
     }).join();
 
-
     match result {
         Ok(_) => {}
         Err(err) => panic!(err),
     }
     rx.recv().unwrap();
-
 }
 
 #[test]
-fn it_copy_with_progress_using_first_levels(){
-
+fn it_copy_with_progress_using_first_levels() {
     let test_dir = Path::new(TEST_FOLDER).join("it_copy_with_progress_using_first_levels");
     let path_to = test_dir.join("out");
     let d_level_1 = (test_dir.join("d_level_1"), path_to.join("d_level_1"));
@@ -1264,11 +1271,11 @@ fn it_copy_with_progress_using_first_levels(){
     let d_level_4 = (d_level_3.0.join("d_level_4"), d_level_3.1.join("d_level_4"));
     let d_level_5 = (d_level_4.0.join("d_level_5"), d_level_4.1.join("d_level_5"));
 
-    let file1 = (d_level_1.0.join("file1.txt"),d_level_1.1.join("file1.txt"));
-    let file2 = (d_level_2.0.join("file2.txt"),d_level_2.1.join("file2.txt"));
-    let file3 = (d_level_3.0.join("file3.txt"),d_level_3.1.join("file3.txt"));
-    let file4 = (d_level_4.0.join("file4.txt"),d_level_4.1.join("file4.txt"));
-    let file5 = (d_level_5.0.join("file5.txt"),d_level_5.1.join("file5.txt"));
+    let file1 = (d_level_1.0.join("file1.txt"), d_level_1.1.join("file1.txt"));
+    let file2 = (d_level_2.0.join("file2.txt"), d_level_2.1.join("file2.txt"));
+    let file3 = (d_level_3.0.join("file3.txt"), d_level_3.1.join("file3.txt"));
+    let file4 = (d_level_4.0.join("file4.txt"), d_level_4.1.join("file4.txt"));
+    let file5 = (d_level_5.0.join("file5.txt"), d_level_5.1.join("file5.txt"));
 
     create_all(&d_level_1.0, true).unwrap();
     create_all(&d_level_2.0, true).unwrap();
@@ -1284,7 +1291,6 @@ fn it_copy_with_progress_using_first_levels(){
     assert!(d_level_4.0.exists());
     assert!(d_level_5.0.exists());
 
-
     assert!(!d_level_1.1.exists());
     assert!(!d_level_2.1.exists());
     assert!(!d_level_3.1.exists());
@@ -1346,10 +1352,8 @@ fn it_copy_with_progress_using_first_levels(){
         assert!(!file4.1.exists());
         assert!(!file5.1.exists());
         assert!(files_eq(&file1.0, &file1.1));
-
     }).join();
 
-
     match result {
         Ok(_) => {}
         Err(err) => panic!(err),
@@ -1358,15 +1362,11 @@ fn it_copy_with_progress_using_first_levels(){
     match rx.recv() {
         Err(_) => panic!("Errors should not be!"),
         _ => {}
-
     }
-
 }
 
-
 #[test]
 fn it_copy_with_progress_using_four_levels() {
-
     let test_dir = Path::new(TEST_FOLDER).join("it_copy_with_progress_using_four_levels");
     let path_to = test_dir.join("out");
     let d_level_1 = (test_dir.join("d_level_1"), path_to.join("d_level_1"));
@@ -1375,11 +1375,11 @@ fn it_copy_with_progress_using_four_levels() {
     let d_level_4 = (d_level_3.0.join("d_level_4"), d_level_3.1.join("d_level_4"));
     let d_level_5 = (d_level_4.0.join("d_level_5"), d_level_4.1.join("d_level_5"));
 
-    let file1 = (d_level_1.0.join("file1.txt"),d_level_1.1.join("file1.txt"));
-    let file2 = (d_level_2.0.join("file2.txt"),d_level_2.1.join("file2.txt"));
-    let file3 = (d_level_3.0.join("file3.txt"),d_level_3.1.join("file3.txt"));
-    let file4 = (d_level_4.0.join("file4.txt"),d_level_4.1.join("file4.txt"));
-    let file5 = (d_level_5.0.join("file5.txt"),d_level_5.1.join("file5.txt"));
+    let file1 = (d_level_1.0.join("file1.txt"), d_level_1.1.join("file1.txt"));
+    let file2 = (d_level_2.0.join("file2.txt"), d_level_2.1.join("file2.txt"));
+    let file3 = (d_level_3.0.join("file3.txt"), d_level_3.1.join("file3.txt"));
+    let file4 = (d_level_4.0.join("file4.txt"), d_level_4.1.join("file4.txt"));
+    let file5 = (d_level_5.0.join("file5.txt"), d_level_5.1.join("file5.txt"));
 
     create_all(&d_level_1.0, true).unwrap();
     create_all(&d_level_2.0, true).unwrap();
@@ -1395,7 +1395,6 @@ fn it_copy_with_progress_using_four_levels() {
     assert!(d_level_4.0.exists());
     assert!(d_level_5.0.exists());
 
-
     assert!(!d_level_1.1.exists());
     assert!(!d_level_2.1.exists());
     assert!(!d_level_3.1.exists());
@@ -1460,10 +1459,8 @@ fn it_copy_with_progress_using_four_levels() {
         assert!(files_eq(&file2.0, &file2.1));
         assert!(files_eq(&file3.0, &file3.1));
         assert!(files_eq(&file4.0, &file4.1));
-
     }).join();
 
-
     match result {
         Ok(_) => {}
         Err(err) => panic!(err),
@@ -1472,7 +1469,86 @@ fn it_copy_with_progress_using_four_levels() {
     match rx.recv() {
         Err(_) => panic!("Errors should not be!"),
         _ => {}
+    }
+}
+#[test]
+fn it_copy_with_progress_content_only_option() {
+    let test_dir = Path::new(TEST_FOLDER).join("it_copy_with_progress_content_only_option");
+    let path_to = test_dir.join("out");
+    let d_level_1 = (test_dir.join("d_level_1"), path_to.clone());
+    let d_level_2 = (d_level_1.0.join("d_level_2"), d_level_1.1.join("d_level_2"));
+    let d_level_3 = (d_level_2.0.join("d_level_3"), d_level_2.1.join("d_level_3"));
+
+    let file1 = (d_level_1.0.join("file1.txt"), d_level_1.1.join("file1.txt"));
+    let file2 = (d_level_2.0.join("file2.txt"), d_level_2.1.join("file2.txt"));
+    let file3 = (d_level_3.0.join("file3.txt"), d_level_3.1.join("file3.txt"));
+
+    create_all(&d_level_1.0, true).unwrap();
+    create_all(&d_level_2.0, true).unwrap();
+    create_all(&d_level_3.0, true).unwrap();
+    create_all(&path_to, true).unwrap();
+
+    assert!(path_to.exists());
+    assert!(d_level_1.0.exists());
+    assert!(d_level_2.0.exists());
+    assert!(d_level_3.0.exists());
+
+    assert!(!d_level_2.1.exists());
+    assert!(!d_level_3.1.exists());
+
+    fs_extra::file::write_all(&file1.0, "content1").unwrap();
+    fs_extra::file::write_all(&file2.0, "content2").unwrap();
+    fs_extra::file::write_all(&file3.0, "content3").unwrap();
+
+    assert!(file1.0.exists());
+    assert!(file2.0.exists());
+    assert!(file3.0.exists());
+
+    assert!(!file1.1.exists());
+    assert!(!file2.1.exists());
+    assert!(!file3.1.exists());
+
+    let mut options = CopyOptions::new();
+    options.content_only = true;
+    let (tx, rx) = mpsc::channel();
+    let result = thread::spawn(move || {
+        let func_test = |process_info: TransitProcess| {
+            tx.send(process_info).unwrap();
+            TransitProcessResult::ContinueOrAbort
+        };
+
+        let result = copy_with_progress(&d_level_1.0, &path_to, &options, func_test).unwrap();
+
+        assert_eq!(24, result);
+
+        assert!(d_level_1.0.exists());
+        assert!(d_level_2.0.exists());
+        assert!(d_level_3.0.exists());
+
+        assert!(d_level_1.1.exists());
+        assert!(d_level_2.1.exists());
+        assert!(d_level_3.1.exists());
+
+        assert!(file1.0.exists());
+        assert!(file2.0.exists());
+        assert!(file3.0.exists());
+
+        assert!(file1.1.exists());
+        assert!(file2.1.exists());
+        assert!(file3.1.exists());
+        assert!(files_eq(&file1.0, &file1.1));
+        assert!(files_eq(&file2.0, &file2.1));
+        assert!(files_eq(&file3.0, &file3.1));
+    }).join();
 
+    match result {
+        Ok(_) => {}
+        Err(err) => panic!(err),
+    }
+
+    match rx.recv() {
+        Err(_) => panic!("Errors should not be!"),
+        _ => {}
     }
 }
 
@@ -1514,9 +1590,8 @@ fn it_copy_inside_work_target_dir_not_exist() {
 #[test]
 fn it_copy_inside_work_target_dir_exist_with_no_source_dir_named_sub_dir() {
     let path_root = Path::new(TEST_FOLDER);
-    let root = path_root.join(
-        "it_copy_inside_work_target_dir_exist_with_no_source_dir_named_sub_dir",
-    );
+    let root =
+        path_root.join("it_copy_inside_work_target_dir_exist_with_no_source_dir_named_sub_dir");
     let root_dir1 = root.join("dir1");
     let root_dir1_sub = root_dir1.join("sub");
     let root_dir2 = root.join("dir2");
@@ -1599,16 +1674,14 @@ fn it_copy_inside_work_target_dir_exist_with_source_dir_exist() {
     let mut options = CopyOptions::new();
     options.copy_inside = true;
     match copy(&root_dir1, &root_dir2, &options) {
-        Err(err) => {
-            match err.kind {
-                ErrorKind::AlreadyExists => {
-                    assert_eq!(1, 1);
-                }
-                _ => {
-                    panic!(format!("wrong error {}", err.to_string()));
-                }
+        Err(err) => match err.kind {
+            ErrorKind::AlreadyExists => {
+                assert_eq!(1, 1);
             }
-        }
+            _ => {
+                panic!(format!("wrong error {}", err.to_string()));
+            }
+        },
         Ok(_) => {
             panic!("should be error");
         }
@@ -1627,7 +1700,6 @@ fn it_copy_inside_work_target_dir_exist_with_source_dir_exist() {
     assert!(compare_dir(&root_dir1, &root_dir2));
 }
 
-
 // The compare_dir method assumes that the folder `path_to` must have a sub folder named the last component of the `path_from`.
 // In order to compare two folders with different name but share the same structure, rewrite a new compare method to do that!
 fn compare_dir_recursively<P, Q>(path_from: P, path_to: Q) -> bool
@@ -1725,21 +1797,19 @@ fn it_move_not_folder() {
     fs_extra::file::write_all(&path_from, "test").unwrap();
 
     match move_dir(&path_from, &path_to, &options) {
-        Err(err) => {
-            match err.kind {
-                ErrorKind::InvalidFolder => {
-                    let wrong_path = format!(
-                        "Path \"{}\" is not a directory or you don't have \
-                                              access!",
-                        path_from.to_str().unwrap()
-                    );
-                    assert_eq!(wrong_path, err.to_string());
-                }
-                _ => {
-                    panic!("wrong error");
-                }
+        Err(err) => match err.kind {
+            ErrorKind::InvalidFolder => {
+                let wrong_path = format!(
+                    "Path \"{}\" is not a directory or you don't have \
+                     access!",
+                    path_from.to_str().unwrap()
+                );
+                assert_eq!(wrong_path, err.to_string());
             }
-        }
+            _ => {
+                panic!("wrong error");
+            }
+        },
         Ok(_) => {
             panic!("should be error");
         }
@@ -1760,18 +1830,15 @@ fn it_move_source_not_exist() {
 
     let options = CopyOptions::new();
     match move_dir(&path_from, &path_to, &options) {
-        Err(err) => {
-            match err.kind {
-                ErrorKind::NotFound => {
-                    let wrong_path =
-                        format!("Path \"{}\" does not exist", path_from.to_str().unwrap());
-                    assert_eq!(wrong_path, err.to_string());
-                }
-                _ => {
-                    panic!(format!("wrong error {}", err.to_string()));
-                }
+        Err(err) => match err.kind {
+            ErrorKind::NotFound => {
+                let wrong_path = format!("Path \"{}\" does not exist", path_from.to_str().unwrap());
+                assert_eq!(wrong_path, err.to_string());
             }
-        }
+            _ => {
+                panic!(format!("wrong error {}", err.to_string()));
+            }
+        },
         Ok(_) => {
             panic!("should be error");
         }
@@ -1808,7 +1875,6 @@ fn it_move_exist_overwrite() {
     fs_extra::file::write_all(&file2_path, &content2).unwrap();
     assert!(file2_path.exists());
 
-
     let mut exist_path = path_to.clone();
     exist_path.push(&test_name);
     create(&exist_path, true).unwrap();
@@ -1819,7 +1885,6 @@ fn it_move_exist_overwrite() {
     fs_extra::file::write_all(&exist_path, exist_content).unwrap();
     assert!(exist_path.exists());
 
-
     let mut options = CopyOptions::new();
     options.overwrite = true;
     move_dir(&path_from, &path_to, &options).unwrap();
@@ -1862,17 +1927,15 @@ fn it_move_exist_not_overwrite() {
 
     let options = CopyOptions::new();
     match move_dir(&path_from, &path_to, &options) {
-        Err(err) => {
-            match err.kind {
-                ErrorKind::AlreadyExists => {
-                    let wrong_path = format!("Path \"{}\" is exist", exist_path.to_str().unwrap());
-                    assert_eq!(wrong_path, err.to_string());
-                }
-                _ => {
-                    panic!(format!("wrong error {}", err.to_string()));
-                }
+        Err(err) => match err.kind {
+            ErrorKind::AlreadyExists => {
+                let wrong_path = format!("Path \"{}\" is exist", exist_path.to_str().unwrap());
+                assert_eq!(wrong_path, err.to_string());
             }
-        }
+            _ => {
+                panic!(format!("wrong error {}", err.to_string()));
+            }
+        },
         Ok(_) => {
             panic!("should be error");
         }
@@ -1909,7 +1972,6 @@ fn it_move_exist_skip_exist() {
     fs_extra::file::write_all(&file2_path, &content2).unwrap();
     assert!(file2_path.exists());
 
-
     let mut exist_path = path_to.clone();
     exist_path.push(&test_name);
     create(&exist_path, true).unwrap();
@@ -1920,7 +1982,6 @@ fn it_move_exist_skip_exist() {
     fs_extra::file::write_all(&exist_path, exist_content).unwrap();
     assert!(exist_path.exists());
 
-
     let mut options = CopyOptions::new();
     options.skip_exist = true;
     move_dir(&path_from, &path_to, &options).unwrap();
@@ -1964,7 +2025,6 @@ fn it_move_exist_overwrite_and_skip_exist() {
     fs_extra::file::write_all(&file2_path, &content2).unwrap();
     assert!(file2_path.exists());
 
-
     let mut exist_path = path_to.clone();
     exist_path.push(&test_name);
     create(&exist_path, true).unwrap();
@@ -1975,7 +2035,6 @@ fn it_move_exist_overwrite_and_skip_exist() {
     fs_extra::file::write_all(&exist_path, exist_content).unwrap();
     assert!(exist_path.exists());
 
-
     let mut options = CopyOptions::new();
     options.overwrite = true;
     options.skip_exist = true;
@@ -2028,9 +2087,8 @@ fn it_move_inside_work_target_dir_not_exist() {
 #[test]
 fn it_move_inside_work_target_dir_exist_with_no_source_dir_named_sub_dir() {
     let path_root = Path::new(TEST_FOLDER);
-    let root = path_root.join(
-        "it_move_inside_work_target_dir_exist_with_no_source_dir_named_sub_dir",
-    );
+    let root =
+        path_root.join("it_move_inside_work_target_dir_exist_with_no_source_dir_named_sub_dir");
     let root_dir1 = root.join("dir1");
     let root_dir1_sub = root_dir1.join("sub");
     let root_dir2 = root.join("dir2");
@@ -2119,16 +2177,14 @@ fn it_move_inside_work_target_dir_exist_with_source_dir_exist() {
     let mut options = CopyOptions::new();
     options.copy_inside = true;
     match copy(&root_dir1, &root_dir2, &options) {
-        Err(err) => {
-            match err.kind {
-                ErrorKind::AlreadyExists => {
-                    assert_eq!(1, 1);
-                }
-                _ => {
-                    panic!(format!("wrong error {}", err.to_string()));
-                }
+        Err(err) => match err.kind {
+            ErrorKind::AlreadyExists => {
+                assert_eq!(1, 1);
             }
-        }
+            _ => {
+                panic!(format!("wrong error {}", err.to_string()));
+            }
+        },
         Ok(_) => {
             panic!("should be error");
         }
@@ -2149,7 +2205,65 @@ fn it_move_inside_work_target_dir_exist_with_source_dir_exist() {
     assert!(root_dir2_dir1_sub_file2.exists());
     assert!(root_dir2_dir3_file3.exists());
 }
+#[test]
+fn it_move_content_only_option() {
+    let test_dir = Path::new(TEST_FOLDER).join("it_move_content_only_option");
+    let path_to = test_dir.join("out");
+    let d_level_1 = (test_dir.join("d_level_1"), path_to.clone());
+    let d_level_2 = (d_level_1.0.join("d_level_2"), d_level_1.1.join("d_level_2"));
+    let d_level_3 = (d_level_2.0.join("d_level_3"), d_level_2.1.join("d_level_3"));
+
+    let file1 = (d_level_1.0.join("file1.txt"), d_level_1.1.join("file1.txt"));
+    let file2 = (d_level_2.0.join("file2.txt"), d_level_2.1.join("file2.txt"));
+    let file3 = (d_level_3.0.join("file3.txt"), d_level_3.1.join("file3.txt"));
+
+    create_all(&d_level_1.0, true).unwrap();
+    create_all(&d_level_2.0, true).unwrap();
+    create_all(&d_level_3.0, true).unwrap();
+    create_all(&path_to, true).unwrap();
+
+    assert!(path_to.exists());
+    assert!(d_level_1.0.exists());
+    assert!(d_level_2.0.exists());
+    assert!(d_level_3.0.exists());
+
+    assert!(!d_level_2.1.exists());
+    assert!(!d_level_3.1.exists());
+
+    fs_extra::file::write_all(&file1.0, "content1").unwrap();
+    fs_extra::file::write_all(&file2.0, "content2").unwrap();
+    fs_extra::file::write_all(&file3.0, "content3").unwrap();
+
+    assert!(file1.0.exists());
+    assert!(file2.0.exists());
+    assert!(file3.0.exists());
+
+    assert!(!file1.1.exists());
+    assert!(!file2.1.exists());
+    assert!(!file3.1.exists());
 
+    let mut options = CopyOptions::new();
+    options.content_only = true;
+    let result = move_dir(&d_level_1.0, path_to, &options).unwrap();
+
+    assert_eq!(24, result);
+
+    assert!(!d_level_1.0.exists());
+    assert!(!d_level_2.0.exists());
+    assert!(!d_level_3.0.exists());
+
+    assert!(d_level_1.1.exists());
+    assert!(d_level_2.1.exists());
+    assert!(d_level_3.1.exists());
+
+    assert!(!file1.0.exists());
+    assert!(!file2.0.exists());
+    assert!(!file3.0.exists());
+
+    assert!(file1.1.exists());
+    assert!(file2.1.exists());
+    assert!(file3.1.exists());
+}
 #[test]
 fn it_move_progress_work() {
     let mut path_from = PathBuf::from(TEST_FOLDER);
@@ -2219,7 +2333,6 @@ fn it_move_progress_work() {
         Ok(_) => {}
         Err(err) => panic!(err),
     }
-
 }
 
 #[test]
@@ -2246,29 +2359,25 @@ fn it_move_with_progress_not_folder() {
         TransitProcessResult::ContinueOrAbort
     };
 
-
     match move_dir_with_progress(&path_from, &path_to, &options, func_test) {
-        Err(err) => {
-            match err.kind {
-                ErrorKind::InvalidFolder => {
-                    let wrong_path = format!(
-                        "Path \"{}\" is not a directory!",
-                        path_from.to_str().unwrap()
-                    );
-                    assert_eq!(wrong_path, err.to_string());
-                }
-                _ => {
-                    panic!("wrong error");
-                }
+        Err(err) => match err.kind {
+            ErrorKind::InvalidFolder => {
+                let wrong_path = format!(
+                    "Path \"{}\" is not a directory!",
+                    path_from.to_str().unwrap()
+                );
+                assert_eq!(wrong_path, err.to_string());
             }
-        }
+            _ => {
+                panic!("wrong error");
+            }
+        },
         Ok(_) => {
             panic!("should be error");
         }
     }
 }
 
-
 #[test]
 fn it_move_with_progress_work_dif_buf_size() {
     let mut path_from = PathBuf::from(TEST_FOLDER);
@@ -2365,7 +2474,6 @@ fn it_move_with_progress_work_dif_buf_size() {
             Ok(_) => {}
             Err(err) => panic!(err),
         }
-
     }).join();
 
     for i in 1..9 {
@@ -2408,23 +2516,20 @@ fn it_move_with_progress_source_not_exist() {
             TransitProcessResult::ContinueOrAbort
         };
 
-
         match move_dir_with_progress(&path_from, &path_to, &options, func_test) {
-            Err(err) => {
-                match err.kind {
-                    ErrorKind::NotFound => {
-                        let wrong_path = format!(
-                            "Path \"{}\" does not exist or you don't \
-                                                      have access!",
-                            path_from.to_str().unwrap()
-                        );
-                        assert_eq!(wrong_path, err.to_string());
-                    }
-                    _ => {
-                        panic!(format!("wrong error {}", err.to_string()));
-                    }
+            Err(err) => match err.kind {
+                ErrorKind::NotFound => {
+                    let wrong_path = format!(
+                        "Path \"{}\" does not exist or you don't \
+                         have access!",
+                        path_from.to_str().unwrap()
+                    );
+                    assert_eq!(wrong_path, err.to_string());
                 }
-            }
+                _ => {
+                    panic!(format!("wrong error {}", err.to_string()));
+                }
+            },
             Ok(_) => {
                 panic!("should be error");
             }
@@ -2438,7 +2543,6 @@ fn it_move_with_progress_source_not_exist() {
     match rx.recv() {
         Err(_) => {}
         _ => panic!("should be error"),
-
     }
 }
 
@@ -2489,16 +2593,13 @@ fn it_move_with_progress_exist_overwrite() {
         assert_eq!(23, result);
         assert!(path_to.exists());
         assert!(!path_from.exists());
-
     }).join();
 
-
     match result {
         Ok(_) => {}
         Err(err) => panic!(err),
     }
     rx.recv().unwrap();
-
 }
 
 #[test]
@@ -2544,14 +2645,11 @@ fn it_move_with_progress_exist_not_overwrite() {
         let result = move_dir_with_progress(&path_from, &path_to, &options, func_test);
         match result {
             Ok(_) => panic!("Should be error!"),
-            Err(err) => {
-                match err.kind {
-                    ErrorKind::AlreadyExists => {}
-                    _ => panic!("Wrong wrror"),
-                }
-            }
+            Err(err) => match err.kind {
+                ErrorKind::AlreadyExists => {}
+                _ => panic!("Wrong wrror"),
+            },
         }
-
     }).join();
 
     match result {
@@ -2563,8 +2661,7 @@ fn it_move_with_progress_exist_not_overwrite() {
         Err(_) => {
             panic!("Error not should be!");
         }
-        _ => {} 
-
+        _ => {}
     }
 }
 
@@ -2615,10 +2712,8 @@ fn it_move_with_progress_exist_skip_exist() {
         assert_eq!(0, result);
         assert!(path_from.exists());
         assert!(path_to.exists());
-
     }).join();
 
-
     match result {
         Ok(_) => {}
         Err(err) => panic!(err),
@@ -2627,12 +2722,9 @@ fn it_move_with_progress_exist_skip_exist() {
     match rx.recv() {
         Err(_) => {}
         _ => panic!("should be error"),
-
     }
-
 }
 
-
 #[test]
 fn it_move_with_progress_exist_overwrite_and_skip_exist() {
     let mut path_from = PathBuf::from(TEST_FOLDER);
@@ -2671,7 +2763,6 @@ fn it_move_with_progress_exist_overwrite_and_skip_exist() {
     options.skip_exist = true;
     let (tx, rx) = mpsc::channel();
     let result = thread::spawn(move || {
-
         let func_test = |process_info: TransitProcess| {
             tx.send(process_info).unwrap();
             TransitProcessResult::ContinueOrAbort
@@ -2682,20 +2773,15 @@ fn it_move_with_progress_exist_overwrite_and_skip_exist() {
         assert_eq!(23, result);
         assert!(path_to.exists());
         assert!(!path_from.exists());
-
     }).join();
 
-
-
     match result {
         Ok(_) => {}
         Err(err) => panic!(err),
     }
     rx.recv().unwrap();
-
 }
 
-
 #[test]
 fn it_get_folder_size() {
     let mut path = PathBuf::from(TEST_FOLDER);
@@ -2750,17 +2836,13 @@ fn it_get_size_not_found() {
 
     match get_size(&path) {
         Ok(_) => panic!("Should be a error!"),
-        Err(err) => {
-            match err.kind {
-                ErrorKind::NotFound => {}
-                _ => panic!("Wrong error!"),
-            }
-        }
+        Err(err) => match err.kind {
+            ErrorKind::NotFound => {}
+            _ => panic!("Wrong error!"),
+        },
     };
-
 }
 
-
 #[test]
 fn it_get_dir_content() {
     let mut path = PathBuf::from(TEST_FOLDER);
@@ -2904,12 +2986,16 @@ fn it_get_dir_content_many_levels() {
         }
     }
     assert!(directories_correct);
-    assert!(result.directories.contains(
-        &file1.parent().unwrap().to_str().unwrap().to_string(),
-    ));
-    assert!(result.directories.contains(
-        &file2.parent().unwrap().to_str().unwrap().to_string(),
-    ));
+    assert!(
+        result
+            .directories
+            .contains(&file1.parent().unwrap().to_str().unwrap().to_string(),)
+    );
+    assert!(
+        result
+            .directories
+            .contains(&file2.parent().unwrap().to_str().unwrap().to_string(),)
+    );
 
     // fourth level
     options.depth = 4;
@@ -2930,7 +3016,6 @@ fn it_get_dir_content_many_levels() {
     assert!(result.files.contains(&file3.to_str().unwrap().to_string()));
     assert!(result.files.contains(&file4.to_str().unwrap().to_string()));
 
-
     directories_correct = true;
     for dir in &result.directories {
         if !directories.contains(&dir) {
@@ -2938,25 +3023,33 @@ fn it_get_dir_content_many_levels() {
         }
     }
     assert!(directories_correct);
-    assert!(result.directories.contains(
-        &file1.parent().unwrap().to_str().unwrap().to_string(),
-    ));
-    assert!(result.directories.contains(
-        &file2.parent().unwrap().to_str().unwrap().to_string(),
-    ));
-    assert!(result.directories.contains(
-        &file3.parent().unwrap().to_str().unwrap().to_string(),
-    ));
-    assert!(result.directories.contains(
-        &file4.parent().unwrap().to_str().unwrap().to_string(),
-    ));
-    assert!(result.directories.contains(
-        &file5.parent().unwrap().to_str().unwrap().to_string(),
-    ));
+    assert!(
+        result
+            .directories
+            .contains(&file1.parent().unwrap().to_str().unwrap().to_string(),)
+    );
+    assert!(
+        result
+            .directories
+            .contains(&file2.parent().unwrap().to_str().unwrap().to_string(),)
+    );
+    assert!(
+        result
+            .directories
+            .contains(&file3.parent().unwrap().to_str().unwrap().to_string(),)
+    );
+    assert!(
+        result
+            .directories
+            .contains(&file4.parent().unwrap().to_str().unwrap().to_string(),)
+    );
+    assert!(
+        result
+            .directories
+            .contains(&file5.parent().unwrap().to_str().unwrap().to_string(),)
+    );
 }
 
-
-
 #[test]
 fn it_get_dir_content_path_file() {
     let mut path = PathBuf::from(TEST_FOLDER);
@@ -2985,17 +3078,13 @@ fn it_get_dir_content_not_found() {
 
     assert!(!path.exists());
 
-
     match get_dir_content(&path) {
         Ok(_) => panic!("Should be a error!"),
-        Err(err) => {
-            match err.kind {
-                ErrorKind::NotFound => {}
-                _ => panic!("Wrong error!"),
-            }
-        }
+        Err(err) => match err.kind {
+            ErrorKind::NotFound => {}
+            _ => panic!("Wrong error!"),
+        },
     }
-
 }
 
 #[test]
@@ -3086,7 +3175,6 @@ fn it_details_item_dir() {
     }
 
     assert_eq!(10, fields);
-
 }
 
 #[test]
@@ -3186,7 +3274,6 @@ fn it_details_file_item() {
     }
 
     assert_eq!(11, fields);
-
 }
 
 #[test]
@@ -3210,7 +3297,6 @@ fn it_details_item_dir_short() {
             assert_eq!(0, size);
         }
     }
-
 }
 
 #[test]
@@ -3236,10 +3322,8 @@ fn it_details_item_file_short() {
             assert_eq!(7, size);
         }
     }
-
 }
 
-
 #[test]
 fn it_ls() {
     let test_dir = Path::new(TEST_FOLDER).join("it_ls");
@@ -3290,13 +3374,9 @@ fn it_ls() {
                 assert_eq!(false, is_dir);
             }
         }
-
-
     }
-
 }
 
-
 #[test]
 fn it_copy_with_progress_exist_user_decide_overwrite() {
     let test_dir = Path::new(TEST_FOLDER).join("it_copy_with_progress_exist_user_decide_overwrite");
@@ -3305,11 +3385,9 @@ fn it_copy_with_progress_exist_user_decide_overwrite() {
     let file1 = (dir.0.join("file1.txt"), dir.1.join("file1.txt"));
     let file2 = (dir.0.join("file2.txt"), dir.1.join("file2.txt"));
 
-
     create_all(&dir.0, true).unwrap();
     create_all(&dir.1, true).unwrap();
 
-
     assert!(&dir.0.exists());
     assert!(&dir.1.exists());
 
@@ -3352,10 +3430,8 @@ fn it_copy_with_progress_exist_user_decide_overwrite() {
         assert!(dir.0.exists());
         assert!(dir.1.exists());
         assert!(compare_dir(&dir.0, &out));
-
     }).join();
 
-
     match result {
         Ok(_) => {}
         Err(err) => panic!(err),
@@ -3363,7 +3439,6 @@ fn it_copy_with_progress_exist_user_decide_overwrite() {
     rx.try_recv().unwrap();
 }
 
-
 #[test]
 fn it_copy_with_progress_exist_user_decide_overwrite_all() {
     let test_dir =
@@ -3373,11 +3448,9 @@ fn it_copy_with_progress_exist_user_decide_overwrite_all() {
     let file1 = (dir.0.join("file1.txt"), dir.1.join("file1.txt"));
     let file2 = (dir.0.join("file2.txt"), dir.1.join("file2.txt"));
 
-
     create_all(&dir.0, true).unwrap();
     create_all(&dir.1, true).unwrap();
 
-
     assert!(&dir.0.exists());
     assert!(&dir.1.exists());
 
@@ -3420,10 +3493,8 @@ fn it_copy_with_progress_exist_user_decide_overwrite_all() {
         assert!(dir.0.exists());
         assert!(dir.1.exists());
         assert!(compare_dir(&dir.0, &out));
-
     }).join();
 
-
     match result {
         Ok(_) => {}
         Err(err) => panic!(err),
@@ -3439,11 +3510,9 @@ fn it_copy_with_progress_exist_user_decide_skip() {
     let file1 = (dir.0.join("file1.txt"), dir.1.join("file1.txt"));
     let file2 = (dir.0.join("file2.txt"), dir.1.join("file2.txt"));
 
-
     create_all(&dir.0, true).unwrap();
     create_all(&dir.1, true).unwrap();
 
-
     assert!(&dir.0.exists());
     assert!(&dir.1.exists());
 
@@ -3486,10 +3555,8 @@ fn it_copy_with_progress_exist_user_decide_skip() {
         assert!(dir.0.exists());
         assert!(dir.1.exists());
         assert!(!compare_dir(&dir.0, &out));
-
     }).join();
 
-
     match result {
         Ok(_) => {}
         Err(err) => panic!(err),
@@ -3550,10 +3617,8 @@ fn it_copy_with_progress_exist_user_decide_skip_all() {
         assert!(dir.0.exists());
         assert!(dir.1.exists());
         assert!(!compare_dir(&dir.0, &out));
-
     }).join();
 
-
     match result {
         Ok(_) => {}
         Err(err) => panic!(err),
@@ -3618,10 +3683,8 @@ fn it_copy_with_progress_exist_user_decide_retry() {
         assert!(dir.0.exists());
         assert!(dir.1.exists());
         assert!(!compare_dir(&dir.0, &out));
-
     }).join();
 
-
     match result {
         Ok(_) => {}
         Err(err) => panic!(err),
@@ -3669,7 +3732,6 @@ fn it_copy_with_progress_inside_work_target_dir_not_exist() {
         assert!(root_dir1_sub.exists());
         assert!(root_dir2.exists());
         assert!(compare_dir_recursively(&root_dir1, &root_dir2));
-
     }).join();
 
     loop {
@@ -3869,9 +3931,8 @@ fn it_copy_with_progress_inside_no_overwrite_work_target_dir_exist_with_source_d
 #[test]
 fn it_copy_with_progress_inside_overwrite_work_target_dir_exist_with_source_dir_exist() {
     let path_root = Path::new(TEST_FOLDER);
-    let root = path_root.join(
-        "it_copy_with_progress_inside_overwrite_work_target_dir_exist_with_source_dir_exist",
-    );
+    let root = path_root
+        .join("it_copy_with_progress_inside_overwrite_work_target_dir_exist_with_source_dir_exist");
     let root_dir1 = root.join("dir1");
     let root_dir1_sub = root_dir1.join("sub");
     let root_dir2 = root.join("dir2");
@@ -3962,11 +4023,9 @@ fn it_move_with_progress_exist_user_decide_overwrite() {
     let file1 = (dir.0.join("file1.txt"), dir.1.join("file1.txt"));
     let file2 = (dir.0.join("file2.txt"), dir.1.join("file2.txt"));
 
-
     create_all(&dir.0, true).unwrap();
     create_all(&dir.1, true).unwrap();
 
-
     assert!(&dir.0.exists());
     assert!(&dir.1.exists());
 
@@ -4008,10 +4067,8 @@ fn it_move_with_progress_exist_user_decide_overwrite() {
         assert_eq!(16, result);
         assert!(!dir.0.exists());
         assert!(dir.1.exists());
-
     }).join();
 
-
     match result {
         Ok(_) => {}
         Err(err) => panic!(err),
@@ -4019,7 +4076,6 @@ fn it_move_with_progress_exist_user_decide_overwrite() {
     rx.try_recv().unwrap();
 }
 
-
 #[test]
 fn it_move_with_progress_exist_user_decide_overwrite_all() {
     let test_dir =
@@ -4029,11 +4085,9 @@ fn it_move_with_progress_exist_user_decide_overwrite_all() {
     let file1 = (dir.0.join("file1.txt"), dir.1.join("file1.txt"));
     let file2 = (dir.0.join("file2.txt"), dir.1.join("file2.txt"));
 
-
     create_all(&dir.0, true).unwrap();
     create_all(&dir.1, true).unwrap();
 
-
     assert!(&dir.0.exists());
     assert!(&dir.1.exists());
 
@@ -4075,10 +4129,8 @@ fn it_move_with_progress_exist_user_decide_overwrite_all() {
         assert_eq!(16, result);
         assert!(!dir.0.exists());
         assert!(dir.1.exists());
-
     }).join();
 
-
     match result {
         Ok(_) => {}
         Err(err) => panic!(err),
@@ -4094,11 +4146,9 @@ fn it_move_with_progress_exist_user_decide_skip() {
     let file1 = (dir.0.join("file1.txt"), dir.1.join("file1.txt"));
     let file2 = (dir.0.join("file2.txt"), dir.1.join("file2.txt"));
 
-
     create_all(&dir.0, true).unwrap();
     create_all(&dir.1, true).unwrap();
 
-
     assert!(&dir.0.exists());
     assert!(&dir.1.exists());
 
@@ -4140,10 +4190,8 @@ fn it_move_with_progress_exist_user_decide_skip() {
         assert_eq!(0, result);
         assert!(dir.0.exists());
         assert!(dir.1.exists());
-
     }).join();
 
-
     match result {
         Ok(_) => {}
         Err(err) => panic!(err),
@@ -4203,10 +4251,8 @@ fn it_move_with_progress_exist_user_decide_skip_all() {
         assert_eq!(0, result);
         assert!(dir.0.exists());
         assert!(dir.1.exists());
-
     }).join();
 
-
     match result {
         Ok(_) => {}
         Err(err) => panic!(err),
@@ -4270,10 +4316,8 @@ fn it_move_with_progress_exist_user_decide_retry() {
         assert_eq!(0, result);
         assert!(dir.0.exists());
         assert!(dir.1.exists());
-
     }).join();
 
-
     match result {
         Ok(_) => {}
         Err(err) => panic!(err),
@@ -4630,3 +4674,80 @@ fn it_move_dir_with_progress_inside_overwrite_work_target_dir_exist_with_source_
         Err(err) => panic!(err),
     }
 }
+#[test]
+fn it_move_with_progress_content_only_option() {
+    let test_dir = Path::new(TEST_FOLDER).join("it_move_with_progress_content_only_option");
+    let path_to = test_dir.join("out");
+    let d_level_1 = (test_dir.join("d_level_1"), path_to.clone());
+    let d_level_2 = (d_level_1.0.join("d_level_2"), d_level_1.1.join("d_level_2"));
+    let d_level_3 = (d_level_2.0.join("d_level_3"), d_level_2.1.join("d_level_3"));
+
+    let file1 = (d_level_1.0.join("file1.txt"), d_level_1.1.join("file1.txt"));
+    let file2 = (d_level_2.0.join("file2.txt"), d_level_2.1.join("file2.txt"));
+    let file3 = (d_level_3.0.join("file3.txt"), d_level_3.1.join("file3.txt"));
+
+    create_all(&d_level_1.0, true).unwrap();
+    create_all(&d_level_2.0, true).unwrap();
+    create_all(&d_level_3.0, true).unwrap();
+    create_all(&path_to, true).unwrap();
+
+    assert!(path_to.exists());
+    assert!(d_level_1.0.exists());
+    assert!(d_level_2.0.exists());
+    assert!(d_level_3.0.exists());
+
+    assert!(!d_level_2.1.exists());
+    assert!(!d_level_3.1.exists());
+
+    fs_extra::file::write_all(&file1.0, "content1").unwrap();
+    fs_extra::file::write_all(&file2.0, "content2").unwrap();
+    fs_extra::file::write_all(&file3.0, "content3").unwrap();
+
+    assert!(file1.0.exists());
+    assert!(file2.0.exists());
+    assert!(file3.0.exists());
+
+    assert!(!file1.1.exists());
+    assert!(!file2.1.exists());
+    assert!(!file3.1.exists());
+
+    let mut options = CopyOptions::new();
+    options.content_only = true;
+    let (tx, rx) = mpsc::channel();
+    let result = thread::spawn(move || {
+        let func_test = |process_info: TransitProcess| {
+            tx.send(process_info).unwrap();
+            TransitProcessResult::ContinueOrAbort
+        };
+
+        let result = move_dir_with_progress(&d_level_1.0, &path_to, &options, func_test).unwrap();
+
+        assert_eq!(24, result);
+
+        assert!(!d_level_1.0.exists());
+        assert!(!d_level_2.0.exists());
+        assert!(!d_level_3.0.exists());
+
+        assert!(d_level_1.1.exists());
+        assert!(d_level_2.1.exists());
+        assert!(d_level_3.1.exists());
+
+        assert!(!file1.0.exists());
+        assert!(!file2.0.exists());
+        assert!(!file3.0.exists());
+
+        assert!(file1.1.exists());
+        assert!(file2.1.exists());
+        assert!(file3.1.exists());
+    }).join();
+
+    match result {
+        Ok(_) => {}
+        Err(err) => panic!(err),
+    }
+
+    match rx.recv() {
+        Err(_) => panic!("Errors should not be!"),
+        _ => {}
+    }
+}