ComfyUI Node

Path Parser

Split a file path into name, folder, and extension

By aidec·Created 2 years ago·Updated 9 months ago· 19
Path Parser
    • file_name_no_ext
    • folder_path
    • extension
    • absolute_path
    • status
    file_path
    normalize_pathtrue

    Path Parser is the little utility you didn't know you needed until you're three nodes deep in a batch workflow holding a full file path and wanting just the filename. Hand it something like F:/AI/ComfyUI/output/portrait.png and it breaks it into parts: the name, the folder, the extension, the cleaned-up absolute path. That's the whole node. No magic, just the string-splitting chore you'd otherwise do by hand - or, in ComfyUI, couldn't do at all without a node like this.

    It fits naturally alongside the rest of aidec's batch pack. When a folder loader or queue node hands you full paths and your downstream nodes want name-only pieces - a Save Image prefix, a folder to write into, a metadata sidecar - Path Parser is the adapter in between.

    How it works

    It runs the path through the same kind of split you'd get from a standard path library: separate the directory from the filename, separate the filename from its extension, and optionally normalize the whole thing so mixed slashes and relative bits get tidied into one clean absolute path. Nothing touches the disk - it's purely operating on the string you give it, so it doesn't matter whether the file actually exists.

    The inputs that matter

    • file_path - the path string to pick apart. This is the only real input.
    • normalize_path - on by default. Leave it on and the absolute_path output comes back cleaned up (consistent separators, resolved relative pieces). Turn it off if you specifically want the path left exactly as you passed it.

    Outputs: file_name_no_ext (the bare name, no extension - usually the one you want for a save prefix), folder_path (the directory), extension, absolute_path (the normalized full path), and status. Pick whichever piece the next node needs and ignore the rest.

    Installing it

    cd ComfyUI/custom_nodes && git clone https://github.com/aidec/Comfyui_TextBatch_aidec, then restart ComfyUI (or ComfyUI Manager → Install via Git URL). No models, no extra dependencies. It's under the TextBatch category.

    Where people get burned

    • It parses, it doesn't validate. Path Parser will happily split a path to a file that isn't there - it's just string work. If a downstream node then fails to open the file, that's a missing-file problem, not a parser problem. Check the path exists separately.
    • Mixed slashes. Windows paths with backslashes and forward slashes mixed together are exactly what normalize_path is for - leave it on unless you have a reason not to.
    • You may not need it. Some nodes in this same pack (Image Filename Processor, Load Image By Index) already emit the pieces you're after. If you're already using one of those, you might be reaching for Path Parser to redo work you've already got. It shines when all you have is a raw path string and nothing else has broken it down yet.

    Unglamorous, occasionally exactly what unblocks you. That's a fair description of a good utility node.

    CategoryTextBatch

    Inputs (2)

    NameTypeDefaultDescription
    file_pathSTRING
    normalize_pathBOOLEANtrue

    Outputs (5)

    NameTypeDescription
    file_name_no_extSTRING
    folder_pathSTRING
    extensionSTRING
    absolute_pathSTRING
    statusSTRING