mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 13:25:11 +00:00
Create images directory if doesn't exist, to store image search results
This commit is contained in:
@@ -190,6 +190,10 @@ def collate_results(hits, image_names, output_directory, image_files_url, count=
|
||||
target_image_name = f"{index}{source_path.suffix}"
|
||||
target_path = resolve_absolute_path(f"{output_directory}/{target_image_name}")
|
||||
|
||||
# Create output directory, if it doesn't exist
|
||||
if not target_path.parent.exists():
|
||||
target_path.parent.mkdir(exist_ok=True)
|
||||
|
||||
# Copy the image to the output directory
|
||||
shutil.copy(source_path, target_path)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user