π FW File Count In Directory
A quick sanity check on how many files are actually in a folder
- INT
This one's the odd node out in its own pack - the other three Fearnworks nodes are all about CLIP token budgets, and this is plain filesystem bookkeeping. Point it at a folder, get back a number. Sounds too simple to need a node for, until you're staring at a LoRA training run that only picked up 12 images when you were sure you'd curated 20, and you'd rather find that out before you spend GPU time than after.
FileCountInDirectory counts the files in a directory, with an optional filter so you're not just getting "everything in this folder" when you actually care about "how many .pngs are in this folder."
How it works
You give it a path, it lists what's in there, and it counts. The optional filter narrows that count by file type instead of counting every file regardless of extension.
The inputs and outputs that matter
directory_path(STRING) - the folder you want counted. This is the one input you're actually setting every time.file_types- a filter string, defaulting to*(everything). The schema lists this as a required field, but the default wildcard means in practice you can leave it alone unless you specifically want to filter - e.g. counting only images versus counting captions.
Output is a single INT - the file count. Wire it into a text/int preview node to just read the number, or use it to gate the rest of your graph (for example, only proceeding if the count is above zero).
How to install it
Same install as the rest of the pack - this node isn't split out separately:
- ComfyUI Manager - search "Fearnworks Nodes" and install.
- Manual:
then restart. No dependencies to install and nothing to download - it's a filesystem read, not a model.cd ComfyUI/custom_nodes git clone https://github.com/fearnworks/ComfyUI_FearnworksNodes
Common issues & troubleshooting
Where this actually earns its keep is dataset prep. Character LoRAs typically land in the 15-25 image range, style LoRAs 30-100, concept LoRAs 20-50 - before you kick off a training run, pointing this node at your dataset folder is a five-second way to confirm the count matches what you meant to curate, rather than finding out mid-training that half your images didn't get copied over.
The file_types filter syntax isn't documented beyond "optional, filters by file type." The README doesn't specify whether it expects a glob pattern like *.png, a bare extension like png, or a comma-separated list for multiple types. The default * is a safe fallback if you're unsure - test your exact syntax on a folder with a known count before trusting the filtered result on something that matters.
Path formatting is on you. Like any directory-path text input, this is the kind of node that's picky about absolute-vs-relative paths and OS-specific separators. If you get a zero back on a folder you know isn't empty, double-check the path is exactly what ComfyUI's Python process would resolve, not a path that only makes sense from inside your file explorer.
It's a small utility pack from one developer, not something running at scale. That's not a knock - it does what it says - but it also means edge cases like network drives, symlinks, or unusual permissions are plausibly untested territory. Nothing in the pack's own docs claims otherwise, so treat unusual paths with a bit of caution and verify the count on a folder you already know the answer for.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| directory_path | STRING | β | |
| file_types | STRING | * | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | β |