Nodes/RobeNodes/Get File Name 🐤
ComfyUI Node

Get File Name 🐤

Turn a full path into the bits you actually wanted

By RobeSantoro·Created 2 years ago·Updated 3 months ago· 0
Get File Name 🐤
    • file_name
    • parent_folder
    file_path

    You've got a full path to a file and you need the bare filename - no directory, no extension - plus the folder it lives in. That's the whole job of this node, and it's one of those little helpers that saves you from string-slicing by hand every time you wire a file list into a save prefix or a display node. It's part of the plumbing layer: no pixels, no models, just path math with a clear contract.

    How it works

    The single input, file_path (STRING, forceInput), takes a full path. The node normalizes backslashes to forward slashes, so W:\foo\bar\clip.mp4 and /home/user/clip.mp4 both behave. Then it splits:

    • file_name - the basename minus extension. clip.mp4clip
    • parent_folder - the immediate parent folder name with a trailing slash. /foo/bar/clip.mp4bar/

    Both come out as STRING. The trailing slash on parent_folder is deliberate - the author built it so you can concat straight into a save path or a filename_prefix without adding your own separator. That's the shape of a node made for real workflows, not for symmetry.

    Where it fits

    This node's natural partners are the other path helpers in the same pack. List Model Path, List Video Path, and List Image Path hand you full selected paths; drop one through Get File Name and you've got a clean name for a filename_prefix or a downstream loader that wants a bare filename. It also plays nice with ComfyUI's filename_prefix templating, where %date:yyyy-MM-dd% and node-value tokens already let you build names from live values.

    Installing the pack

    Search "Robe Nodes" in ComfyUI Manager, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/RobeSantoro/ComfyUI-RobeNodes
    

    Then restart ComfyUI. Nothing heavy here - the pack's dependencies (opencv-python, google-genai, piexif, requests) are pulled by Manager; this node itself touches none of them.

    Where people get burned

    Two things to keep straight. First, parent_folder is only the immediate folder - for C:\a\b\c.txt you get b/, not a/b/. If you need the full directory path, that's the file_path minus the filename, which this node doesn't give you. Second, forceInput means you wire the path in rather than typing it; if you want a literal path you'll convert the widget to input and connect a primitive.

    Tiny node, but once you're batch-processing files, it earns its place on the canvas.

    CategoryRobeNodes

    Inputs (1)

    NameTypeDefaultDescription
    file_pathSTRING

    Outputs (2)

    NameTypeDescription
    file_nameSTRING
    parent_folderSTRING