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

πŸ“ Get File Path

Get the path of a file in your input folder, in four pieces

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

    Plenty of useful nodes take a path rather than an image tensor: the pack's own Groq transcription node wants an audio file path, "save text to file" nodes want somewhere to write, and a handful of video and audio loaders want a location on disk. πŸ“ Get File Path is the node that turns a file sitting in ComfyUI's input/ folder into strings you can feed those nodes.

    One input, four outputs:

    • full_file_path - the whole thing, absolute.
    • file_path_only - the parent directory.
    • file_name_only - the filename without the extension.
    • file_extension_only - the extension, with its dot.

    If the file doesn't exist, all four come back empty and you get a console message saying so, which is the usual cause of "why is my transcription node saying file not found".

    The extension-with-dot, name-without-extension thing

    Read that list again, because it's the one detail that catches people building filenames. file_name_only is the stem: my_song.mp3 gives you my_song, and file_extension_only gives you .mp3. So to rebuild the original name you concatenate them, and to write a sibling file you'd do file_path_only + "/" + file_name_only + ".txt". If you assumed file_name_only included the extension you'll produce my_song.mp3.txt, which works fine until something else tries to open it.

    The tooltip on the output says "The name of the file" - the code says stem. Trust the code.

    The input, and why it feels broken

    image is a dropdown of files from your input directory. It is called image, but it accepts any file - the tooltip tells you to "select any file type when uploading a non-image file", i.e. use ComfyUI's own file picker prompt and switch the filter from the image types to any.

    The author is upfront in the README that this should have a proper browse button and doesn't yet: "If you know how to add this, please let me know or do a pull request." So the workflow is: upload your .mp3 or .wav or .txt through this node's picker (which copies it into input/), then wire full_file_path downstream. It's clunky, it works, and it does mean your file ends up in input/ whether you wanted that or not.

    Where it's genuinely useful

    The strongest use in this pack is the pairing with βœ¨πŸ“ Groq ALM API - Transcribe, whose file_path input is a plain string that must point at a real audio file. Drop Get File Path next to it, pick your track, wire full_file_path in, done - no copy-pasting Windows paths with escaped backslashes.

    Its second life is namespacing: build output paths and filenames out of the pieces instead of retyping them, so a batch of files derived from reference_shot.png lands next to each other with predictable names.

    Install

    ComfyUI Manager β†’ ComfyUI-mnemic-nodes, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MNeMoNiCuZ/ComfyUI-mnemic-nodes
    

    Restart. Nothing downloads for this node - it's pathlib and nothing else. The pack's other requirements (transformers, opencv-python, imageio, piexif, tiktoken, groq…) install alongside it because they're all in one requirements.txt, which is the standing annoyance with grab-bag packs: you want a path helper, you get a Python ML stack.

    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