Skip to content
Node packVerifiedExternal
Open source

ComfyUI-FilePathsFromFolder

ComfyUI node to load file paths from folders by extension for batch processing workflows.

Maintainer@RockyHongUnratedgrade

Package profile

Status
Verified
Publisher
@RockyHong
Source
GitHub

README

ComfyUI-FilePathsFromFolder

Load file paths from a folder by extension (*.png, *.mp4, *.txt, etc.), then feed them into any ComfyUI node that accepts a path (image/video/audio/anything-from-path).

This repo is mainly for easy batch processing:

  • Use it with your favorite loop/for/while node pack (pick items by index), or
  • Use this repo’s simple loop node (File Paths For Loop Start) to have ComfyUI run downstream nodes once per file (list batching).

Installation

Recommended: Git clone

  1. Clone into ComfyUI/custom_nodes
cd path/to/ComfyUI/custom_nodes
git clone https://github.com/RockyHong/ComfyUI-FilePathsFromFolder.git
  1. Restart ComfyUI
  2. Search nodes by name: Load File Paths From Folder, Get File Path By Index, File Paths For Loop Start, File Paths For Loop Sync

Alternative: Manual install (ZIP)

  1. Download ZIP from GitHub
  2. Extract
  3. Copy folder ComfyUI-FilePathsFromFolder into ComfyUI/custom_nodes/
  4. Restart ComfyUI

Integrate with external for/loop nodes (index-based)

Use this when you already have an external loop/for/while node pack and you want to drive it with “files in a folder” (by extension).

Nodes used

  • LoadFilePathsFromFolder: scan folder → get filepaths / filenames / count
  • GetPathByIndex: choose one item → get filepath / filename (UI: Get File Path By Index)

Example workflow (external loop pack)

Option A — External Loop Method

  1. LoadFilePathsFromFolder (set folder path + extension)
  2. count → your loop node “iterations” / “max” (names vary by pack)
  3. Loop index → GetPathByIndex.index
  4. LoadFilePathsFromFolder.filepaths + .filenames → GetPathByIndex
  5. GetPathByIndex.filepath → your loader node (Load Image / Load Video / etc.)
  6. Do your processing + save/export inside your external loop pack

Built-in simple for-loop node (list batching)

Use this when you want the simplest setup: File Paths For Loop Start returns lists, and ComfyUI runs downstream nodes once per file via list batching.

Nodes used

  • File Paths For Loop Start: generates the per-file list outputs (current_filepath, current_index, etc.)
  • File Paths For Loop End: loop terminator / completion signal

Example workflow (internal loop: once per file)

Option B — Internal Loop Node Method

  1. File Paths For Loop Start (set folder path + extension)
  2. current_filepath → your loader node (e.g. Load Image)
  3. Your processing nodes
  4. (Optional) outputs you want to guarantee run (e.g. save/write/export nodes) → FilePathsEnsureExecution.passthrough_1 … passthrough_5
  5. current_index → File Paths For Loop End.current_index
  6. (Optional) FilePathsEnsureExecution.passthrough → File Paths For Loop End.passthrough (this “anchors” the route so it executes)

Memory note

File Paths For Loop Start uses ComfyUI list batching (OUTPUT_IS_LIST): ComfyUI may run the workflow one node at a time for all files, rather than finishing file 0 completely before starting file 1.

  • What you'll see: it may run like "load all → process all → save all", not "load → process → save" per file.
  • When this is good: if you want to run many files with the same model/settings, batching can help keep the model "warm" and avoid offload/reload each file.
  • Why memory can climb: more intermediate results may stay in RAM/VRAM until later nodes run.
  • Solution for mid-batch cleanup: Use File Paths For Loop Sync Trigger + File Paths For Loop Sync Resume to run cleanup once between batch stages (see Batch Synchronization below).
  • Need true one-file-at-a-time? Use an external loop/for/while node pack that runs each file start→finish before moving on.

(Optional

Nodes in this pack

7 nodes
  • FilePathsEnsureExecution
  • FilePathsForLoop
  • FilePathsLoopClose
  • FilePathsLoopSyncResume
  • FilePathsLoopSyncTrigger
  • GetPathByIndex
  • LoadFilePathsFromFolder

Sources

3 sources
GitHubSourceVersion c541fa4a310e201fa3632d25b48cb8ede09859ee
github.com/RockyHong/ComfyUI-FilePathsFromFolder

Verified Oct 14

Source excerpts

1 excerpt

Source context: Repo RockyHong/ComfyUI-FilePathsFromFolder