Nodes/ComfyUI-mnemic-nodes/πŸ“ Get File Path
ComfyUI Node

πŸ“ Get File Path

Get File Path β€” ComfyUI Node Guide

By MNeMoNiCuZΒ·Created 3 years agoΒ·Updated 20 days agoΒ· 105
πŸ“ Get File Path
    • full_file_path
    • file_path_only
    • file_name_only
    • file_extension_only
    β—„imageβ–Ύβ–Ί

    This is a small, single-purpose node with an oddly specific job: turn a file sitting in ComfyUI's /input folder into a set of plain-text path strings you can hand to other nodes. It exists because a lot of the ecosystem - external tools you shell out to, save nodes that want to reference an existing file, anything that wants a filesystem path rather than a decoded IMAGE tensor - needs the location of a file, not its contents.

    The clever bit is in how it uses ComfyUI's built-in upload widget. That widget is designed for images, but the tooltip is explicit that you can upload any file type through it as long as you tell it to accept all file types when picking one - the widget doesn't actually care what it's holding, it just needs something in /input to point at. So this node doubles as a general "give me the path to whatever I just uploaded" tool, not strictly an image-path tool, despite the widget's obvious framing.

    Input: a single dropdown, image, that lists whatever's already sitting in your /input folder - pick the file you want the path for.

    Outputs: four different slices of the same path, because different downstream nodes want different pieces. full_file_path is the complete absolute path. file_path_only is just the containing folder. file_name_only is just the filename without its folder. file_extension_only is just the extension. Most workflows only need one of these at a time - file_name_only if you're using it as a label or a save-prefix, full_file_path if you're handing it to something that needs to open the file directly.

    It pairs naturally with other file-handling nodes in this same pack. Save an output with Save Text File With Path and you already get its path back directly from that node, but for anything that started life as an upload rather than something you just wrote - a reference image, a mask, a source file someone else provided - this is the node that turns it into a string. Core ComfyUI's own Load Image node, by comparison, never exposes a path at all; it just hands you the decoded tensor and expects that to be enough. This node exists specifically for the workflows where it isn't.

    Installing it is the same as the rest of the pack: search "ComfyUI-mnemic-nodes" in ComfyUI Manager, or cd ComfyUI/custom_nodes && git clone https://github.com/MNeMoNiCuZ/ComfyUI-mnemic-nodes and restart. Nothing to download beyond the node code itself.

    The one real limitation, and it's structural rather than a bug: this node can only see files that have gone through ComfyUI's own upload mechanism into /input. If the file you actually want a path for lives somewhere else on disk - a different folder, a network share, wherever - this node has no way to reach it, because it's built entirely on top of the upload widget's own file listing. For that case you want a different tool depending on direction: this pack's Download Image from URL node if the file needs fetching from the web first, or Save Text File With Path's own path/prefix outputs if you're the one writing the file in the first place and just want to remember where it went.

    Category⚑ MNeMiC Nodes

    Inputs (1)

    NameTypeDefaultDescription
    imageCOMBOMake sure to select any file type when uploading a non-image file.

    Outputs (4)

    NameTypeDescription
    full_file_pathSTRINGThe full path to the file
    file_path_onlySTRINGThe path to the file
    file_name_onlySTRINGThe name of the file
    file_extension_onlySTRINGThe extension of the file