From 0a50d6b33f6a947d367e4c5b8125264340e7966b Mon Sep 17 00:00:00 2001 From: Mathieu David Date: Fri, 18 Sep 2015 15:28:58 +0200 Subject: [PATCH] Fixed the error in copy_files_except_ext #55 --- src/utils/mod.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils/mod.rs b/src/utils/mod.rs index b284938c..080d08a6 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -150,7 +150,12 @@ pub fn copy_files_except_ext(from: &Path, to: &Path, recursive: bool, ext_blackl if metadata.is_dir() && recursive { if entry.path() == to.to_path_buf() { continue } debug!("[*] is dir"); - try!(fs::create_dir(&to.join(entry.file_name()))); + + // check if output dir already exists + if !to.join(entry.file_name()).exists() { + try!(fs::create_dir(&to.join(entry.file_name()))); + } + try!(copy_files_except_ext( &from.join(entry.file_name()), &to.join(entry.file_name()),