remove first

This commit is contained in:
Antonio J. Delgado 2022-05-02 15:00:16 +03:00
parent 86deb0c7f8
commit 3bc270f67a

View file

@ -126,6 +126,9 @@ class image_classifier:
'{person_path}'...") '{person_path}'...")
shutil.copy(file, person_path) shutil.copy(file, person_path)
if not self.no_move: 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}'...") self._log.info(f"Moving file '{file}' to '{new_path}'...")
shutil.move(file, new_path) shutil.move(file, new_path)
else: else: