String Stripper (Path & Ext)
Get the Bare Model Name Out of a Full Path
- string_out
Here's a small annoyance every ComfyUI regular has hit: a loader hands you models/checkpoints/BeautifulMix_v2.1.safetensors and you need just BeautifulMix_v2.1 - for a filename, a sidecar lookup, or a conditional that switches on the model name. String Stripper (Path & Ext) is the node that does that one transformation, and it's exactly as boring and useful as it sounds.
It's from artyclaw/artyclaw-comfy, and the class name (CheckpointNameStripper) doesn't match the display name ("String Stripper (Path & Ext)") - a reminder that this pack is a personal toolkit with the author's own naming baked in. The display name is the accurate one: it strips a path down to the filename, then strips the extension.
How it works
Three steps, no magic:
- Normalize backslashes to forward slashes, so Windows paths (
models\checkpoints\foo.safetensors) and POSIX paths behave identically. - Split on
/and take the last segment - the filename. os.path.splitexton that to drop the extension.
path/to/model.safetensors → model. C:/models/char_style.safetensors → char_style. Empty input returns an empty string rather than erroring, which keeps downstream nodes alive.
Input and output
One input, string_in - a plain single-line string. It's declared with forceInput in the source, meaning you're expected to wire it from another node (a checkpoint loader's output, a folder parser, a file selector) rather than hand-type it. One output, string_out, with the bare name.
It's the kind of node you chain: Folder File Selector → CheckpointNameStripper → a text concat node that builds a save filename, or → a switch that routes on which model is loaded. Nothing here touches files itself - it's a pure string function.
Install
ComfyUI Manager → search ArtyClaw Comfy Nodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/artyclaw/artyclaw-comfy
Restart. Standard library only.
Where people get burned
The main gotcha is expectation mismatch: if you feed it something that isn't a path, like a bare model.safetensors, it still works (no slashes to strip, just the extension), but if you feed it a name with no extension at all, it returns it unchanged - nothing to strip. And it only strips the last extension, so model.v2.safetensors → model.v2, which is correct behavior for multi-dot names but easy to misread at a glance. There's also no option to keep the extension; if you need the full filename, this isn't the node. For a zero-config utility, it does exactly what it says and stays out of your way.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| string_in | STRING | Input string (e.g., path/to/model.safetensors) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| string_out | STRING | — |