Skip to content

Commit 1801d92

Browse files
fix: update file processing logic to use os.walk for better directory traversal
1 parent 1b08688 commit 1801d92

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

file_handler/file_processor.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@ def process_files(self):
2323
return
2424

2525
files = [f for f in os.listdir(self.config.SOURCE_FOLDER) if os.path.isfile(os.path.join(self.config.SOURCE_FOLDER, f))]
26-
for filename in files:
27-
filepath = os.path.join(self.config.SOURCE_FOLDER, filename)
28-
self.file_organizer.organize_file(filepath)
26+
27+
for root, _, files in os.walk(self.config.SOURCE_FOLDER):
28+
for filename in files:
29+
filepath = os.path.join(root, filename)
30+
self.file_organizer.organize_file(filepath)
31+
32+
logger.info("File processing completed successfully.")
2933
except Exception as e:
3034
logger.error(f"Error processing files: {e}")

0 commit comments

Comments
 (0)