ComfyUI Node

Filter List

Keep only the entries you actually meant to keep

By TinyBeeman·Created about a year ago·Updated about a month ago· 1
Filter List
    • filtered_list
    string_list
    string_filter
    age_filter-1
    age_filter_unitdays
    invertfalse

    If Get File List hands you the whole directory, Filter List is what you use to carve it down. It takes a string list and keeps only the entries that match your criteria - a text filter, a file-age cut-off, or both - with an invert switch for when you want the opposite of what you asked for.

    The everyday use is narrowing a file list: "keep only the PNGs in that subfolder," "only files modified in the last two days," "everything that doesn't match this pattern." Same trick works on plain prompt lists - keep only entries containing a keyword. It slots right after a file-listing node and before the work, so your batch only touches what you meant it to touch.

    How it works

    For each entry it applies the checks in order: the string filter is a case-insensitive substring test (it normalizes slashes so Windows and Unix paths match consistently), and the age filter checks the file's modification time against "now minus N days/hours/minutes." An entry passes if it survives both. With invert on, the result flips to everything that failed.

    The inputs that matter:

    • string_list (STRING, wired) - the list to filter.
    • string_filter (STRING, default blank) - substring to match, case-insensitive. Blank = no text filtering.
    • age_filter (INT, default -1) - -1 turns age filtering off; set a positive number to keep only files newer than that.
    • age_filter_unit - days, hours, or minutes, for the age value above.
    • invert (BOOLEAN, default off) - flip the result set.

    The output is filtered_list - the surviving entries, still in their original order.

    Installing it

    Filter List ships in ComfyUI-TinyBee, a small MIT-licensed utility pack with no models to download. The easy way:

    1. ComfyUI Manager → Custom Nodes Manager.
    2. Search "ComfyUI-TinyBee" and install.
    3. Restart ComfyUI.

    Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/TinyBeeman/ComfyUI-TinyBee
    

    Restart and it's under 🐝TinyBee/Lists. Only the pack's JSON Parser node needs the extra jsonata install.

    Gotchas

    The age filter has a hidden assumption: it treats every list entry as a file path. If you enable it on a list of plain strings (like prompts), entries that aren't real files get dropped silently - that's probably not what you want, so only turn on age_filter for file lists. Also note the string filter matches anywhere in the string, not whole words, and it's case-insensitive with no regex support - if you need regex, the pack's separate Replace List node has you covered for transformations instead. For the classic pipeline: Get File List → Filter List → process.

    Category🐝TinyBee/Lists

    Inputs (5)

    NameTypeDefaultDescription
    string_listSTRING
    string_filterSTRING
    age_filterINT-1-1–18446744073709550000
    age_filter_unitCOMBOdays3 options: days, hours, minutes
    invertBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    filtered_listSTRING