diff --git a/image_classifier/image_classifier.py b/image_classifier/image_classifier.py index 94ac3f0..68e4202 100755 --- a/image_classifier/image_classifier.py +++ b/image_classifier/image_classifier.py @@ -110,10 +110,13 @@ class image_classifier: else: folder = 'unknown-time' new_path = os.path.join(dirname, folder, filename) - os.makedirs(os.path.dirname(new_path), exist_ok=True) + if not os.path.exists(os.path.join(dirname, folder)): + os.makedirs(os.path.dirname(new_path)) if self.people_folder: for person in people: person_path = os.path.join(self.people_folder, person, folder, filename) + if not os.path.exists(os.path.join(self.people_folder, person, folder)): + os.makedirs(os.path.dirname(person_path)) self._log.debug(f"Copying file '{file}' to '{person_path}'...") shutil.copy(file, person_path) if not self.no_move: