List Files From Directory
The directory scanner without the heavy lifting
- filenames
Most loaders try to do too much. They scan a folder and load every file, and half the time you don't want that - you want to look at what's there first, or feed paths into some other node. List Files From Directory strips the "load" part out and just hands you the file list. It's the under-the-hood scanner of SineSwiper's LoadAnim-Adv pack, exposed as its own node because a bare list of paths is genuinely useful on its own.
What it does
Give it a directory path and it returns filenames: a list of matching file paths, sorted and filtered the way you ask. No image decoding, no tensors, no VRAM touched. It shares its guts with the big batch loader - Load Images/Videos From Directory literally calls this same scan function - but it stops at names.
Where you'd actually use it
Two patterns keep coming up:
- Batch-loop plumbing. The output is a list of strings, and ComfyUI will run a downstream node once per item when it doesn't support lists. That means you can chain this into a path-based loader (like Load Image/Video From Path) and process every file in a folder without writing a single loop node yourself. The tooltip says it plainly: "Input nodes that do not support lists of files will be executed one-at-a-time."
- Inspecting before loading. Wire
filenamesinto a text preview node, check you're scanning the right folder and the right extensions, then commit to the heavy loader. Cheaper than discovering your sort order was wrong after loading 400 files.
Inputs
directory- the only required field.file_list_cap- max filenames to return. 0 = no limit.file_start_index- skip this many from the front of the sorted list.include_subfolders- recurse. Off by default.valid_extensions- comma-delimited, defaultjpg,jpeg,png,webp,gif,tga. Toss inmp4,movfor videos.sort_method-None, Alphabetical (ASC/DESC), Numerical (ASC/DESC), Datetime (ASC/DESC). For frame sequences, Numerical is the whole point: natural sorting putsframe2beforeframe10, which alphabetical sorting gets wrong.
Installing
Same as the rest of the pack - ComfyUI Manager (search "LoadAnim"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/SineSwiper/ComfyUI-LoadAnim-Adv.git
Restart ComfyUI. The pack's only dependencies are torch, numpy, and Pillow, and nothing here loads models.
Gotchas
- It errors out if the directory doesn't exist or contains no matching files. That's by design - a silently-empty list is how you end up debugging a pipeline that never ran.
- The list respects your sort order, so
file_start_indexis meaningless without picking asort_method. Leave sort atNone(filesystem order) and your "start at 5" is starting at whatever order the OS returned. - One output, one job. If you need the actual frames, this is a building block, not the destination - feed
filenamesinto a path loader and let the graph do the rest.
It's not the flashiest node in the pack, but it's the one that makes clean batch workflows possible without a pile of hacky workarounds.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| directory | STRING | Absolute or relative path to the image directory. | |
| file_list_capopt | INT | 0 | Maximum amount of files to list out. Zero means no maximum. |
| file_start_indexopt | INT | 0 | Index (zero-based) to start listing files, based on the collected filenames from the directory search. |
| include_subfoldersopt | BOOLEAN | false | Controls whether to recursively search for files within subdirectories. |
| valid_extensionsopt | STRING | jpg,jpeg,png,webp,gif,tga | Comma-delimited list of file extensions to search for. |
| sort_methodopt | COMBO | Controls how to sort the image filename list. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| filenames | STRING | The list of filenames that match the inputs specified. Input nodes that do not support lists of files will be executed one-at-a-time. |