diff --git a/image_classifier/image_classifier.py b/image_classifier/image_classifier.py index 7b3360c..60b9bfa 100755 --- a/image_classifier/image_classifier.py +++ b/image_classifier/image_classifier.py @@ -126,6 +126,9 @@ class image_classifier: '{person_path}'...") shutil.copy(file, person_path) if not self.no_move: + if os.path.exists(os.path.join(new_path, filename)): + self._log.debug(f"Destination '{new_path}/{filename}' exists, removing it...") + os.remove(os.path.join(new_path, filename)) self._log.info(f"Moving file '{file}' to '{new_path}'...") shutil.move(file, new_path) else: