π File Count
How many frames are actually in that folder? One node, no shell required
- TOTAL
Resuming an interrupted animation render is one of those moments where a tiny utility node saves you real time. File Count [Dream] looks at a directory and tells you how many image files match your patterns - which is exactly the number you need when a render died at frame 300 of 1200 and you want to pick up where it left off.
It comes from the Dream Project Animation Nodes pack (alt-key-project), the 2023 Deforum-style animation toolkit. Like the rest of the pack it's no longer actively updated, but this is a ten-line node that doesn't need updates.
How it works
Two inputs, one output. Give it a directory_path and patterns, and it counts the files:
directory_path- the folder to scanpatterns- a|-separated list of glob patterns, default*.jpg|*.png|*.jpeg
Output is TOTAL, an INT with the combined count across all patterns. If the directory doesn't exist, it returns 0 instead of erroring - which is a small kindness that keeps a broken path from killing the whole graph.
Under the hood it's glob summing each pattern. It also re-evaluates via IS_CHANGED whenever the file count changes, so ComfyUI won't serve you a stale count if you add frames mid-session.
Why you'd bother
Three genuine uses:
- Resumable renders. Pair it with Frame Counter (Directory), which derives its position from files on disk. Count what's there, feed it somewhere that needs to know, and a crashed render restarts at the right place.
- Feeding totals. Set
total_frameson a frame counter from the actual number of rendered frames instead of guessing. If you already have 400 frames and want a tweening pass, that number is your input. - Sanity checks. Before you feed a folder to Image Sequence Loader, confirm it actually contains what you think. A typo in the path silently returns 0 - that's often the real bug, and this node surfaces it.
It's the boring kind of node you forget exists until you need it, then you're glad it does.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/alt-key-project/comfyui-dream-project.git
Or via ComfyUI Manager under "Dream Project Animation". No model downloads; the whole pack just needs imageio, scipy, torchvision, pilgram, and evalidate. Mind the numpy<2.0 pin if you see NumPy conflicts elsewhere. It lives under Dream β animation.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| directory_path | STRING | β | |
| patterns | STRING | *.jpg|*.png|*.jpeg | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| TOTAL | INT | β |