summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs
index 12c920d..f390f31 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -7,12 +7,16 @@ use walkdir::WalkDir;
async fn copy(from: String, to: String) -> std::io::Result<()> {
let from_path = std::path::Path::new(&from);
let to_path = std::path::Path::new(&to);
- if from_path.is_dir() {
- std::fs::create_dir_all(to)?;
- } else if from_path.is_file() {
- std::fs::create_dir_all(to_path.parent().unwrap())?;
- std::fs::copy(from, to)?;
+
+ if !to_path.exists() {
+ if from_path.is_dir() {
+ std::fs::create_dir_all(to)?;
+ } else if from_path.is_file() {
+ std::fs::create_dir_all(to_path.parent().unwrap())?;
+ std::fs::copy(from, to)?;
+ }
}
+
Ok(())
}