PD:imagesearch_v1
Search a folder by filename and pull the matches — text files included
- images
- image_names
- txts
Say you keep a folder of reference images named dog_001.png, dog_002.png, cat_003.png, and one day you want every dog dumped into your workflow as a batch. ComfyUI's file picker makes you click each one. PD_ImageSearch ("PD:imagesearch_v1") does it in one shot: give it a folder path and a keyword, and it returns every image whose filename contains that keyword - plus the contents of any matching .txt files with the same name, which is a genuinely clever touch for caption-bundled datasets.
This is a batch/prep node from the 7BEII/Comfyui_PDuse pack (the display name says "PandyTool", which is just the pack's author handle showing through). Its niche is turning a messy folder into a clean, keyword-filtered list without hand-picking files.
How it works
The search is filename matching, not content matching: it walks the folder, normalizes every filename (NFKC + case-insensitive), and keeps files where the keyword appears in the name. Matching logic is Unicode-aware and case-insensitive, so Dog finds dog_001.png. It collects:
- images - every matching image (jpg, jpeg, png, bmp, tiff, webp) loaded into a list, in filename order.
- image_names - the filenames as strings, aligned with the image list.
- txts - the contents of matching
.txtfiles. So if your dataset hasdog_001.txtholding the caption next todog_001.png, you get the captions on the same index as the images.
The last part is the reason to reach for it over a plain folder loader: image and caption come out index-aligned, which is exactly what you need to feed a batch tagging or training-prep workflow. Wire images into an image-list processor and txts into whatever consumes captions, and the pairing is done for you.
The inputs
input_path- the folder to scan. A real absolute path, not a ComfyUI-input-relative one.word- the search keyword.
Both are plain strings; there are no optional inputs. Outputs are the three lists above, all marked as lists so they'll fan out to list-aware nodes.
Installing
ComfyUI Manager, search Comfyui_PDuse; or:
cd ComfyUI/custom_nodes
git clone https://github.com/7BEII/Comfyui_PDuse
cd Comfyui_PDuse
pip install -r requirements.txt
Restart afterwards. Nothing to download - pure folder-scanning, no models.
Gotchas
The README is Chinese, and its error messages are too - if the folder doesn't exist or the keyword is empty, the node raises a clear-ish Chinese error rather than failing silently, so don't panic if you see characters you can't read; it usually means "folder not found." Matching is filename-only, so if your files are named IMG_0001.jpg with no semantic keyword, this node is useless to you - you'd want a plain folder loader (PD_LoadImagesPath in the same pack) instead. And it's a one-folder, non-recursive scan: subfolders aren't searched, and the whole folder is loaded into memory, so point it at a folder you actually want all of.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| input_path | STRING | — | |
| word | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| image_names | STRING | — |
| txts | STRING | — |