Files list from dir [darkilNodes]
List a folder's files inside a workflow — sorted, filtered, and as a count
- found_list
- found_as_text
- last_filename
- first_filename
- files_count
- ❓help
Most workflows load files by picking them from a ComfyUI-provided dropdown. This node does the opposite: it scans a directory and hands you the result as a list, a text blob, a count, and first/last filenames - which is exactly what you want when a workflow needs to process "whatever's newest in this folder" or loop over a batch of images you dropped in a directory. It's the file-glob node the stock UI never quite gives you.
How it works
You give it a folder_path and a files_extension filter, and it globs the directory. The filter is smarter than a plain extension: png and .png are normalized to *.png, and if you type something containing *, ? or [, it's treated as a full glob pattern like *_mask.png. Results are filtered to real files (directories and broken symlinks are skipped), sorted by date, name or size in either direction, and optionally recursed into subfolders.
The inputs that matter:
folder_path(STRING) - the directory to scan.files_extension(STRING, default*.*) - extension or glob pattern.sort_by(COMBO) -by_date,by_date_desc,by_name,by_name_desc,by_size,by_size_desc.sub_foldres(BOOLEAN) - recursive search. (Yes, that's the actual spelling on the socket.)keep_extensions(BOOLEAN, default true) - strip file extensions if you only want stems.keep_full_path(BOOLEAN, default false) - return absolute paths instead of filenames.
The outputs
This is where it earns its keep:
found_list(STRING, list type) - every matched file, one per list entry, ready to iterate.found_as_text(STRING) - the same list as a newline-separated blob, easy to paste or log.last_filename/first_filename(STRING) - the boundary entries after sorting, so "load the newest" becomes a wire fromlast_filenamewithsort_byset toby_date_desc.files_count(INT) - how many files matched, for loop bounds or sanity checks.❓help(STRING) - the pack's signature documentation socket.
One behavior worth knowing: the node marks itself as always-changed, so it re-scans every run - no stale caches if you drop a new file into the folder mid-session.
Where people get burned
Path mistakes, mostly. The path is resolved against the machine running ComfyUI (your ~ works), and a nonexistent folder returns an empty list rather than an error - so a workflow that "silently outputs nothing" is usually a typo in folder_path. And if you filter *.* with recursion on a big folder, expect the scan to take a moment; the node is synchronous. Also note keep_extensions only strips extensions on the display output, so if you wire found_list into a loader that needs real filenames, leave it on.
Installing
In pytraveler/comfyui-darkil-nodes. ComfyUI Manager search ComfyUI-darkil-nodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/pytraveler/comfyui-darkil-nodes
Restart. No Python deps or models - it's a stdlib-pathlib node.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| folder_path | STRING | — | |
| files_extension | STRING | *.* | — |
| sort_by | COMBO | by_date_desc | 6 options: by_date, by_date_desc, by_name, by_name_desc, by_size, by_size_desc |
| sub_foldres | BOOLEAN | false | — |
| keep_extensions | BOOLEAN | true | — |
| keep_full_path | BOOLEAN | false | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| found_list | STRING | — |
| found_as_text | STRING | — |
| last_filename | STRING | — |
| first_filename | STRING | — |
| files_count | INT | — |
| ❓help | STRING | — |