JDCN_AnyFileList
Turn a folder into a list of file paths β without loading a single file
- PathList
- NameList
- Total
JDCN_AnyFileList is the backbone of this pack: point it at a folder and it returns the paths (and names) of the files in it, filtered however you like. Crucially, it never opens those files. It just lists them. That's the design philosophy of the whole pack - work with paths, not payloads, until you actually need the bytes - and it's why this node is fast and RAM-friendly even on folders with hundreds of images.
How it works
Four inputs:
folder_path- the directory to scan. Absolute path, typed directly, no quotes.filter_by- a category dropdown:*,images,audio,video,text,tensors, orfolder. Each category maps to a big hardcoded extension list, so "images" catches everything from.jpgto.dngand.webpwithout you enumerating them.extension- a more specific pick (150+ extensions in the dropdown). Set it to*to skip the fine-grained filter.filter_byplusextensionstack, so you can say "images" and.pngonly.deep_search- off scans just the top level of the folder; on walks every subdirectory recursively.
Three outputs: PathList (full paths), NameList (filenames without extensions), and Total (the count). The names are the thing to remember - if a downstream node wants the bare filename, you don't have to strip the path yourself.
How to use it in a real workflow
The pack's own example is the best one: a single mess of a folder holding images, videos, JSON sidecars, and latents. Run AnyFileList over it with filter_by set to whatever you're after, wire PathList into a loader like JDCN_BatchImageLoadFromList, or into JDCN_FileMover to sort files into per-type directories. Since everything downstream just consumes paths, you can chain several of these in parallel - one for images, one for videos, one for text - off the same folder.
A quirk to know about
File order is whatever the OS hands back from os.listdir / os.walk, and that is not guaranteed to be alphabetical. On Linux it's often inode order; on Windows, roughly creation order. If you're processing a frame sequence and the order matters, don't assume frame10.png sorts before frame9.png - this node won't sort for you. That's a classic footgun, so either pad your filenames (zero-padding solves it) or sort the list yourself with a helper.
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; under π΅ JDCN π΅. Only dependency is piexif, no models.
Common issues
A typo'd folder_path prints "The folder ... does not exist" and returns empty lists - check the console, because the UI won't complain loudly. On Windows, mind the backslashes when typing paths. And if a folder legitimately has no matching files, you get empty PathList and Total = 0, which is correct but easy to mistake for a bug. When your list looks empty, double-check deep_search - files in subfolders are invisible with it off.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| folder_path | STRING | undefined | β |
| filter_by | COMBO | 7 options: *, images, audio, video, text, tensors, +1 | |
| extension | COMBO | 153 options: *, .latent, .ckpt, .pt, .bin, .pth, +147 | |
| deep_search | BOOLEAN | false | β |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| PathList | STRING | β |
| NameList | STRING | β |
| Total | INT | β |