Nodes/comfyui-easyapi-nodes/LoadLocalFilePath
ComfyUI Node

LoadLocalFilePath

List every file in a folder before you loop over it

By lldacing·Created 3 years ago·Updated 8 months ago· 96
LoadLocalFilePath
    • paths
    • count
    • relative_path
    • base_dir
    directory
    max_depth1
    file_typeimage
    file_suffix

    None of this pack's file nodes loop over a directory by themselves - you build that loop yourself out of a list and a for-each. LoadLocalFilePath is the node that hands you the list to loop over: point it at a folder and it walks that folder (optionally several levels deep) and gives you back every matching file's path, ready to feed into ReadTextFromLocalFile, LoadMaskFromLocalPath, or this pack's own ForEachOpen.

    How it works

    • directory - leave it blank and the node walks ComfyUI's own input directory instead of an arbitrary path; that's stated directly in the field's own tooltip.
    • max_depth (default 1, range 1–64) - how many directory levels deep to search. 1 means just the folder you named, no subfolders.
    • file_type - a shortcut dropdown (image / video / text) that filters by the usual extensions for that category.
    • file_suffix - a manual override, pipe-separated (e.g. .png|.jpg). The node's own tooltip is explicit that setting this makes file_type stop having any effect - they don't combine, file_suffix wins outright.

    The inputs and outputs that matter

    Four outputs, each documented with its own tooltip in the node itself:

    • paths - the list of matching file paths; an empty list, not an error, if nothing matched.
    • count - how many files that is, handy as a sanity check or as a value to hand straight back in an API response.
    • relative_path - the same list of files, but relative to the base directory instead of absolute.
    • base_dir - the root directory that actually got searched, useful when you left directory blank and want to confirm what it resolved to.

    How to install it

    Via ComfyUI Manager: search comfyui-easyapi-nodes, install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/lldacing/comfyui-easyapi-nodes.git
    cd comfyui-easyapi-nodes
    pip install -r requirements.txt
    

    Restart ComfyUI; git pull later to upgrade. No models, no heavy dependencies.

    Common issues & troubleshooting

    The file_suffix-beats-file_type behavior is the one that actually catches people. Set file_type to image, then also type .txt into file_suffix expecting them to combine as an AND filter - you'll get text files back, not an empty list, because file_suffix silently overrides file_type rather than adding to it. Clear file_suffix entirely if you want the file_type dropdown to do the filtering.

    This node only builds the list - it doesn't process anything. paths on its own doesn't do a thing to your files; wire it into ListUnWrapper or ForEachOpen to actually iterate over each entry.

    Depth is capped at 64. Fine for basically any real folder structure, but worth knowing it's a hard schema limit if you're ever pointing this at something unusually deep.

    CategoryEasyApi/Utils

    Inputs (4)

    NameTypeDefaultDescription
    directorySTRING若为空,遍历input目录
    max_depthINT11–64查找最大目录层级
    file_typeCOMBOimagefile_suffix值不为空时,此配置失效
    file_suffixSTRING指定过滤文件后缀,多个以|分割,如.png|.jpg

    Outputs (4)

    NameTypeDescription
    pathsLIST文件路径列表,若过滤不到文件返回空列表
    countINT文件个数
    relative_pathLIST文件相对路径列表
    base_dirSTRING保存的根目录