Nodes/ComfyUI Silver Nodes/Silver Folder File Path Loader
ComfyUI Node

Silver Folder File Path Loader

Hand You File Paths Out of a Folder — and Wait for New Ones If You Ask Nicely

By SilverAndJade·Created about a year ago·Updated 23 days ago· 0
Silver Folder File Path Loader
    • file_paths
    • current_index
    folder_path
    regex_filter.*
    batch_size1
    current_index0
    action
    sort_by
    sort_orderascending
    wait_for_newdisable

    Silver Folder File Path Loader doesn't load any media - it hands you file paths as strings, filtered by regex, sorted, and optionally batched. That sounds trivial until you want it: a workflow that needs to know which file to process next, an "incoming" folder that other software drops files into, or a way to watch a directory without babysitting the queue. The one feature that makes this node worth knowing about is wait_for_new, which blocks - up to five minutes - until a new file actually appears.

    How it works

    On each run it lists the top level of the folder, filters filenames against your regex (case-insensitive), sorts them by name, creation date, modification date, or size (natural sort, so img2.png sorts after img10.png correctly), and returns batch_size paths starting at current_index. The action input - fixed, increment, decrement, increment_wrap, or reset - controls how the index advances between runs, and a bundled JS extension writes the next index back into the widget. wait_for_new is the interesting one: with it enabled, the node compares the folder contents to what it saw last run, and if nothing's new, it polls every second until a matching file appears (or it times out at five minutes).

    Inputs that matter

    • folder_path - absolute path to a directory.
    • regex_filter - default .* matches everything. \.png$ grabs only PNGs; scan_\d+\.jpg matches files like scan_042.jpg.
    • batch_size - how many paths to return per run (1–64).
    • action - your stepping strategy; increment walks the sorted list one file per run.
    • sort_by / sort_order - name, created, modified, or size, ascending or descending.
    • wait_for_new - enable makes the run block until a new file shows up.

    Outputs

    • file_paths - the selected paths.
    • current_index - the index used this run, so downstream nodes know where you are.

    Here's the honest quirk: file_paths is declared as a plain STRING output but actually returns a list of path strings. Feed it into list-aware nodes and it's fine; wire it straight into a single-string input expecting one path and you'll get a list where a string should be. Test the connection before relying on it.

    Gotchas

    First, despite the README promising "recursive directory scanning," the code uses os.listdir - top level only, no subfolders. Don't plan around recursive discovery. Second, wait_for_new can hold a run hostage for the full five minutes if a new file never arrives; that's by design, but it will look like ComfyUI froze, so keep the console open and know what you started. Third, the regex runs against the filename only, not the full path. And like the rest of the folder nodes in this pack, an invalid folder path raises a hard error rather than degrading gracefully.

    Install

    ComfyUI Manager → search "ComfyUI Silver Nodes", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/SilverAndJade/comfyui-silver-nodes
    

    Restart ComfyUI after cloning. No extra dependencies beyond stock ComfyUI.

    Categoryimage

    Inputs (8)

    NameTypeDefaultDescription
    folder_pathSTRING
    regex_filterSTRING.*
    batch_sizeINT11–64
    current_indexINT00–1000000
    actionCOMBO5 options: fixed, increment, decrement, increment_wrap, reset
    sort_byCOMBO4 options: name, created, modified, size
    sort_orderCOMBOascending2 options: ascending, descending
    wait_for_newCOMBOdisable2 options: enable, disable

    Outputs (2)

    NameTypeDescription
    file_pathsSTRING
    current_indexINT