Nodes/ComfyUI-FilePathsFromFolder/File Paths For Loop Sync Trigger
ComfyUI Node

File Paths For Loop Sync Trigger

Run one cleanup exactly once between two batch stages

By RockyHong·Created 7 months ago·Updated 7 months ago· 1
File Paths For Loop Sync Trigger
  • anything
  • anything
  • trigger

Once you start using File Paths For Loop Start's list batching, you'll eventually want something done once in the middle - clear VRAM before the next big batch, switch models, write a checkpoint, send a notification. The problem: in a batched stage, everything runs N times. There's no natural "just once" moment. "File Paths For Loop Sync Trigger" is one half of the pack's answer, and its whole job is to create that moment.

It's a splitter. You feed it the batch, and it gives you two outputs: the batch unchanged, and a single non-batched value that you can route into any "run once" node. The mechanism is delightfully blunt: the node reads the whole input list at once (INPUT_IS_LIST = True), then hands the first item out as the trigger. One trigger, not N - that's the entire trick, and it's all it does.

The input

  • anything - any-type, forceInput (a socket, not a widget). Feed it the end of a batched stage. The README's example shows a batched output like your LLM batch or your first image batch; any list output will do.

The outputs

  • anything - the original batch, passed through untouched. It stays a list, so the batch continues as a batch. Wire this into File Paths For Loop Sync Resume.anything.
  • trigger - a single (non-batched) value, the first item of the batch. This is the one you feed into your one-time operation. Because it's a single value, whatever it connects to runs exactly once instead of once per file.

How to wire it with its partner

The README gives the pattern, and it's worth reading the two sync nodes as one feature:

  1. Connect your batched data into Sync Trigger.anything.
  2. Sync Trigger.anythingSync Resume.anything (the batch continues).
  3. Sync Trigger.trigger → your one-time node (clear VRAM, save, switch model, whatever).
  4. That one-time node's output → Sync Resume.wait_for.
  5. Continue the workflow from Sync Resume.anything.

So the Trigger is the "start a one-shot operation and keep the batch flowing" node, and File Paths For Loop Sync Resume is the "wait until it's done before the batch moves on" node. Together they're a barrier: everything before the trigger is batched, the one-shot runs once, and the batch resumes past the resume node.

When it's worth it

This is genuinely a niche tool. If your batches are small or your model stays warm, you don't need a sync barrier at all. It earns its place on long multi-stage runs - the README's own example is "LLM batch → clear VRAM once → T2I batch," which is the classic ComfyUI memory dance where a big generation stage wants the GPU cleaned before the next stage. That's where "once between stages" beats "never" (out of memory) or "every single file" (a reload churn that makes the batch crawl).

Part of the same dependency-free pack: clone https://github.com/RockyHong/ComfyUI-FilePathsFromFolder.git into custom_nodes, restart, find "File Paths For Loop Sync Trigger." Just remember it only does its job in a pair - a Trigger with no Resume is just a fancy way to lose most of your batch.

CategoryFilePathsFromFolder/Loop

Inputs (1)

NameTypeDefaultDescription
anything*

Outputs (2)

NameTypeDescription
anything*
trigger*