JDCN_AnyFileListHelper
Slice a file list by keyword and extension
- out
JDCN_AnyFileListHelper filters an existing list of paths - one that came from JDCN_AnyFileList or anywhere else - down to the files you actually care about. Where AnyFileList filters by category and extension at scan time, this node adds the missing dimension: keyword search. One folder, twelve mixed files, and you want only the portrait JPEGs? This is the node.
How it works
Four inputs, all doing filtering:
List- the path list to filter (list-input).search- keywords, comma-separated. Each file path is kept if it contains any keyword as a substring.portrait,girlkeeps any path containing "portrait" or "girl". This is substring matching, not regex and not case-insensitive-when-you-need-it - mind your capital letters.filter_by- same category dropdown asAnyFileList(*,images,audio,video,text,folder).extension- exact extension filter,*for any.
The filters stack: keyword search first, then category, then extension. Output is a single out list of surviving paths. If nothing survives a stage, it returns an empty list and stops - no crash, just nothing.
The folder category is worth a note: it works by checking os.path.isdir, so with filter_by = folder you're asking for directories, not files. Handy when your list mixes files and subfolders and you want to separate them.
How to use it
The README's example workflow nails the pattern: AnyFileList scans a folder with 12 mixed-format files (webp, gif, png, json, jpeg) into one master list, and then you run several AnyFileListHelper nodes in parallel off that same list - one set to images, one to text, one to video - to split the mess into clean per-type lists. Add a search keyword and you can also pull just "the reference shots of the girl" out of a larger pool.
Installing it
Part of ComfyUI-JDCN:
- ComfyUI Manager β Install Custom Node β search JDCN β install ComfyUI-JDCN β restart.
- Or:
cd ComfyUI/custom_nodes
git clone https://github.com/daxcay/ComfyUI-JDCN.git
cd ComfyUI-JDCN
pip install -r requirements.txt
Restart; it's under π΅ JDCN π΅. Only dependency is piexif.
Common issues
The keyword filter matches against the full path, not just the filename. If your keyword appears in the directory name, files in that directory match too - usually a bonus, occasionally a surprise. Case sensitivity trips people up: "Portrait" won't match "portrait". And remember it's a pure filter - it never touches the files, so if your filtered list is wrong, the filter terms are wrong, not the disk. Same unsorted-order caveat as its sibling AnyFileList applies: whatever order the input list arrived in, that's what you get out.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| List | STRING | β | |
| search | STRING | β | |
| filter_by | COMBO | 6 options: *, images, audio, video, text, folder | |
| extension | COMBO | 147 options: *, .jpg, .jpeg, .png, .gif, .bmp, +141 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| out | STRING | β |