Nodes/Simple File Batcher/Simple File Batcher
ComfyUI Node

Simple File Batcher

See what's actually in that folder — Simple File Batcher does the boring part

By ai-joe-git·Created 8 months ago·Updated 8 months ago· 2
Simple File Batcher
    • file_list
    • file_path_list
    folder_path
    file_filter
    sort_by
    file_extension

    Half the pain of ComfyUI batch work isn't the generation - it's knowing what the heck is sitting in the folder you're about to process. Simple File Batcher is a utils node that fixes exactly that: you point it at a directory, it lists the files with a filter and a sort order, and hands you the result in two text outputs. No models, no API keys, no hidden dependencies. It's the node equivalent of a well-placed ls | grep, except it lives in your graph and doesn't require leaving ComfyUI to check.

    It shines when you're building dataset iteration, wiring a video or text pipeline, or just tired of squinting at your input folder through a file manager. The niche sibling of heavier workflow tools: it doesn't generate anything itself, it just tells the rest of your graph (and you) what's on disk.

    How it works

    Under the hood it's plain os.listdir plus a filter and a sort - no recursion, no globbing, nothing clever. That's a feature for a tool this size. It walks only the top level of the folder you give it; files in subfolders are silently ignored, so if you expect a deep tree you'll want to point it at the exact directory.

    Three behaviors worth knowing before you wire it up:

    • Relative paths resolve to your ComfyUI input folder. Leave folder_path empty or give it a relative path and the node bases itself on folder_paths.get_input_directory(). An absolute path works too and bypasses all of that.
    • file_filter picks a preset extension list. images covers .png .jpg .jpeg .webp .bmp .gif .tiff, videos gets .mp4 .avi .mov .mkv .webm .flv .wmv, text grabs .txt .md .json .yaml .yml .csv .log. Matching is case-insensitive. all skips filtering entirely.
    • file_extension overrides the preset. It's optional, comma-separated, and dots are optional - .png,.jpg and png,jpg behave the same. This is the escape hatch when your files don't fit the built-in buckets.

    sort_by is a plain six-way enum: name/date/size, each asc or desc. Date is file modification time, size is bytes, and sorting is deterministic in a way that keeps name_asc stable across runs - which matters if you're feeding a batch loop and want consistent ordering.

    The inputs and outputs that matter

    Only four inputs total, and you'll actually touch three:

    • folder_path - absolute or relative, or empty to scan the input dir.
    • file_filter - all / images / videos / text.
    • sort_by - name_asc through size_desc.
    • file_extension (optional) - comma-separated custom extensions.

    Both outputs are plain STRING, and here's the honest gotcha: they're not list types. file_list is a numbered, human-readable rundown (0: photo.png per line) and file_path_list is full paths, one per line - but as a single string with newlines, not an actual array. That makes it perfect for eyeballing and for nodes that accept text, but you can't feed file_path_list straight into a loader expecting a path or a list type. To drive a real per-file loop you'd split the string first (a Text/string-split helper handles this). For checking "did my images land, and in what order?" it's exactly right out of the box.

    Installing it

    ComfyUI Manager is the easy route: search "Simple File Batcher" and install. Or the manual way:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ai-joe-git/ComfyUI-Simple-File-Batcher.git
    

    Restart ComfyUI and it appears under utils as "Simple File Batcher." The good news on setup: the package declares zero dependencies - no requirements.txt, no heavy wheels, nothing to fight. If ComfyUI itself runs, this node runs. (Refreshing, given how much of the ecosystem's dependency hell comes from nodes pulling half of PyPI in.)

    Common issues

    • "No files found" - the folder path is wrong, or the filter matches nothing. Remember: a relative path is rooted at your input directory, and file_filter presets are strict about extensions.
    • Subfolders ignored - again, os.listdir only; point the node directly at the subfolder.
    • Custom extensions didn't apply - check you actually filled file_extension; it only overrides when non-empty.
    • Case or weird extensions slipping through - matching is case-insensitive but extension-exact, so a .jpeg won't match a .jpg filter unless the preset includes it (for images it does; custom lists are up to you).

    Tiny, honest, and useful - the kind of node you install once, forget, and quietly reach for on every batch workflow after.

    Categoryutils

    Inputs (4)

    NameTypeDefaultDescription
    folder_pathSTRING
    file_filterCOMBO4 options: all, images, videos, text
    sort_byCOMBO6 options: name_asc, name_desc, date_asc, date_desc, size_asc, size_desc
    file_extensionoptSTRINGComma-separated extensions (e.g., .png,.jpg). Leave empty to use file_filter

    Outputs (2)

    NameTypeDescription
    file_listSTRING
    file_path_listSTRING