Nodes/ArtyClaw Comfy Nodes/Simple Folder Parser
ComfyUI Node

Simple Folder Parser

List Every MP4 (or Anything) in a Folder, With and Without Extensions

By artyclaw·Created 5 months ago·Updated 5 months ago· 0
Simple Folder Parser
    • filenames_with_ext
    • filenames_without_ext
    folder_pathC:/path/to/your/folder
    file_filter*.mp4

    If your workflow ever needs to know what files exist before it processes them - "load every clip in this folder into the video node," "loop over these images," "build a file list for a batch job" - Simple Folder Parser is the honest little node that answers the question. Give it a folder and a glob filter (default *.mp4), and it returns two parallel lists: filenames with their extension and the same names stripped to the stem. Index-aligned, so they always line up.

    It's from artyclaw/artyclaw-comfy, the author's personal IO toolkit. The default filter being *.mp4 tells you it was built for video pipelines - pair it with a video loader that takes a filename list and you've got folder-scale batch video processing without a single manual path.

    How it works

    Under the hood it's a glorified glob. It joins the folder path and filter into a search pattern (C:/folder/*.mp4), calls glob.glob, filters out anything that isn't a regular file (in case the pattern matches a directory), and sorts alphabetically so the order is stable run to run. Then for each match it uses Path.name for the with-extension version and Path.stem for the without-extension version:

    video_01.mp4  →  ["video_01.mp4", "video_01"]
    

    Both outputs are declared OUTPUT_IS_LIST, so downstream nodes see them as list items to iterate.

    Inputs and outputs

    • folder_path - the folder to scan (the default C:/path/to/your/folder is a placeholder, not a real path - you must change it).
    • file_filter - a glob pattern like *.mp4, *.png, img_*.jpg.

    Outputs: filenames_with_ext (list) and filenames_without_ext (list). The stem version is what you'd use to build sidecar lookups (pairing with LoadSidecarPrompt's .txt convention) or to construct output filenames; the full version is what a loader wants.

    Install

    ComfyUI Manager → search ArtyClaw Comfy Nodes, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/artyclaw/artyclaw-comfy
    

    Restart. Pure standard library (os, glob, pathlib).

    Where people get burned

    If the folder doesn't exist, the node returns two empty lists and prints a warning to the console - it does not error, so a mistyped path can silently starve your batch downstream. Watch for that. Second, glob patterns are case-sensitive on most filesystems, so *.MP4 finds nothing when your files are .mp4. Third, the filter is a glob, not a regex - *.mp4 works, but fancy character classes may not behave how you expect. And the placeholder default is a real trap: anyone who runs it before configuring the folder gets empty lists and a confused minute. Set the folder first, then iterate.

    Categoryutils/file

    Inputs (2)

    NameTypeDefaultDescription
    folder_pathSTRINGC:/path/to/your/folder
    file_filterSTRING*.mp4

    Outputs (2)

    NameTypeDescription
    filenames_with_extSTRING
    filenames_without_extSTRING