Limit file deletion to current directory only after document cleaning

This commit is contained in:
yangdx 2025-07-16 20:35:24 +08:00
parent c7b566f6d5
commit 910c6973f3

View file

@ -1301,11 +1301,11 @@ def create_document_routes(
"Starting to delete files in input directory"
)
# Delete all files in input_dir
# Delete only files in the current directory, preserve files in subdirectories
deleted_files_count = 0
file_errors_count = 0
for file_path in doc_manager.input_dir.glob("**/*"):
for file_path in doc_manager.input_dir.glob("*"):
if file_path.is_file():
try:
file_path.unlink()