π·οΈ Suffix
A Filename Suffix Node That Cares About the Extension
- string
What it's actually for
You want render.png to become v03_render_final.png. In a ComfyUI graph, doing that means string surgery on a filename, and the naive way - a text concat node - bites you the first time you append something and get render.png_v03.
This node does the small, correct version: split the path at the extension, insert your prefix and suffix around the stem, put the extension back on the end. Three strings in, one string out. That's the entire node, and that's fine - it's the kind of thing you wire up once and reuse in every project.
It's most useful next to the pack's save nodes, where filename and path are plain strings you can drive from upstream nodes. Swap the name per-run based on a seed, a batch index, or a project tag, and your folder stays organised without renaming anything by hand.
How it works
os.path.splitext does the splitting, a Python f-string does the recombination, and the whole thing is over. Prefix goes before the stem, suffix immediately after it, extension last:
text = "C:/out/asset.png"
prefix = "v03_"
suffix = "_final"
result = "C:/out/v03_asset_final.png"
Two consequences worth noticing. The path is passed through untouched - you can feed it a full path and it'll keep the directory, which is handy when you're driving a saver's path and filename from the same string. And because splitext only splits the last dot, a name like character.head.v2.png keeps the earlier dots intact and suffixes as character.head.v2_final.png.
Empty prefix and suffix leave the string exactly as it arrived, so it's safe to leave in a graph as a no-op placeholder.
The inputs that matter
- text - required, the incoming filename or path.
- prefix - optional, inserted at the front of the stem.
- suffix - optional, inserted at the end of the stem, before the extension.
One output: string. Wire it into any save node's filename input, and into plenty of other places - a string output works anywhere a text field accepts a converted input.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/Antonioilev/ComfyUI_Antonioilev_Lightpack.git
# restart ComfyUI
Manager search: "Antonioilev Light Pack". This node imports nothing beyond Python's standard os, so it's the safest member of the pack to try first - if it's in the Antonioilev/Utils menu, your install worked. If it isn't, the pack's __init__.py swallowed an import error; the console prints a loaded/failed node count.
Where people get burned
- It's string manipulation, not filename sanitising. Spaces, slashes, colons, and unicode all pass straight through. If you're generating names from user text, clean them yourself - a
/in your suffix turns a filename into a subdirectory. - The extension is preserved, not checked. Feed it a path with no extension and you'll get a suffix with no extension after it, which then gets a
.pngappended by whatever saves it. Fine, but surprising if you expected the node to add one. - Two dots, one suffix.
asset.glbbecomesasset_v2.glb, notasset_v2.glb_v2. No surprises there, but if you're suffixing mesh exports, that's the behaviour you want.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | β | |
| prefixopt | STRING | β | |
| suffixopt | STRING | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| string | STRING | β |