Nodes/ComfyUI-mnemic-nodes/πŸ’Ύ Save Text File With Path
ComfyUI Node

πŸ’Ύ Save Text File With Path

Save Text File With Path β€” ComfyUI Node Guide

By MNeMoNiCuZΒ·Created 3 years agoΒ·Updated 17 days agoΒ· 105
πŸ’Ύ Save Text File With Path
    • output_full_path
    • output_name
    • output_path
    β—„file_textβ€”β–Ί
    β—„path[time(%Y-%m-%d)]/β–Ί
    β—„prefix[time(%Y-%m-%d - %H.%M.%S)]β–Ί
    β—„counter_separator_β–Ί
    β—„counter_length3β–Ί
    β—„suffixβ–Ί
    β—„output_extensiontxtβ–Ί

    ComfyUI ships a Save Image node right out of the box, but there's no equivalent for plain text - no built-in way to write a prompt, a caption, a log line, or an LLM response out to a .txt file. That's the actual gap this node fills, and it does one more useful thing on top: it hands you back the exact path it wrote to, so downstream nodes (or you, later) know exactly where the file landed.

    What it saves and how it names it: file_text is the content itself - could be a resolved prompt, a Groq API response, anything upstream produced as a string. path is the folder it lands in, and the default value, [time(%Y-%m-%d)]/, is worth understanding because it's not a literal folder name - it's a template. The square-bracket [time(...)] syntax is the same date-stamping convention this pack's Format Date Time node exposes in full, dropped inline here so you don't need a separate node wired up just to timestamp a folder. Leave the default and every day's output lands in its own dated subfolder automatically.

    prefix works the same way and defaults to [time(%Y-%m-%d - %H.%M.%S)], stamping every filename with the exact moment it was saved. counter_separator and counter_length add a zero-padded counter (three digits by default) between the prefix and suffix so repeated saves in the same run don't collide and overwrite each other. suffix is optional extra text after the counter, and output_extension (default txt) controls the file extension - swap it if you're actually saving something else, like a JSON blob from a metadata node elsewhere in the pack.

    Outputs: output_full_path is the complete path to the file you just wrote - pass this straight to anything downstream that needs to reference the saved file (this pack's own Get File Path node, for instance, or a manifest you're building elsewhere). output_name and output_path split that into just the filename and just the folder, respectively, for whichever half you actually need.

    Installing it: through ComfyUI Manager, search "ComfyUI-mnemic-nodes," or manually: cd ComfyUI/custom_nodes && git clone https://github.com/MNeMoNiCuZ/ComfyUI-mnemic-nodes, then restart. It's a filesystem write, nothing more - no models, no API keys, no dependency risk beyond Python itself.

    What actually goes wrong: the most common issue with any node that writes to disk is a path pointing somewhere ComfyUI's process doesn't have permission to write, especially if you've typed an absolute path outside ComfyUI's own output tree - keep paths relative unless you know the process has access to wherever you're pointing it. If you want every run to overwrite the previous file instead of accumulating numbered copies, set counter_length to 0 - leaving the default means you'll get _001, _002, and so on forever, which is usually what you want for a batch but is a surprise the first time you go looking for "the file" and find fifty of them. And because path and prefix both default to date/time templates, two people running the same default workflow on different days will never collide with each other, but two runs on the same second with the counter reset (say, after clearing your output folder) theoretically could - the counter logic is what actually prevents that in practice, not the timestamp.

    Category⚑ MNeMiC Nodes

    Inputs (7)

    NameTypeDefaultDescription
    file_textSTRINGThe text to save.
    pathSTRING[time(%Y-%m-%d)]/The folder path to save the file to. The following creates a date folder: [time(%Y-%m-%d)]
    prefixSTRING[time(%Y-%m-%d - %H.%M.%S)]The prefix to add to the file name. The following creates a file with a date and timestamp: [time(%Y-%m-%d - %H.%M.%S)]
    counter_separatorSTRING_The separator to use between the file name and the counter.
    counter_lengthINT30–24The number of digits to use in the counter.
    suffixSTRINGThe suffix to add to the file name after the counter.
    output_extensionSTRINGtxtThe extension to use for the output file.

    Outputs (3)

    NameTypeDescription
    output_full_pathSTRINGThe full path to the saved file
    output_nameSTRINGThe name of the saved file
    output_pathSTRINGThe formatted path to the saved file (excluding filename)