Skip to content

Commit ebef212

Browse files
committed
verifie que dst n'existe pas
1 parent a95d3dd commit ebef212

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

watch_and_copy.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ def on_created(self, event):
5454
return
5555
src = Path(event.src_path if isinstance(event.src_path, str) else event.src_path.decode())
5656
dst = self.dest / src.name
57+
if dst.exists():
58+
logging.info(f"Ignoré {src} : {dst} existe déjà")
59+
return
5760
shutil.copy2(src, dst)
5861
logging.info(f"Copié {src}{dst}")
5962

0 commit comments

Comments
 (0)