π CYH File | Folder Filename Builder
A path builder for people who like their saves organized
- full_path
- filename
Somewhere between "save everything flat into the output folder" and "hand-maintain ten subdirectories" there's a middle ground: a node that constructs a folder path for you, from a project name, an optional subfolder, and a filename. That's this node. It doesn't write anything, it doesn't touch disk - it just builds the path string and hands it to whatever save node comes next.
It's part of the Chye ComfyUI Toolset's file category, and honestly it's a niche tool. But if you generate a lot of organized batches - per-project folders with consistent naming - it can save you from rebuilding the same path structure in every save node.
How it works
The node takes three strings plus a delimiter and joins them:
path_components = [project_name]
if use_subfolders and subfolder:
path_components.append(subfolder)
path_components.append(filename)
full_path = delimiter.join(path_components)
So project_name="MyProject", subfolder="images", filename="image01", delimiter / gives you MyProject/images/image01. The delimiter dropdown (/, _, -, \) is the interesting bit: pick _ and you get MyProject_images_image01 - useful when you want a flat but unique name instead of a directory tree.
The inputs that matter
- project_name - the base identifier, e.g.
MyProject. Empty falls back toUntitledProject. - filename - output name without extension (default
image01). Add the extension downstream or in your save node. - use_subfolders - toggle the subfolder into the path (default on).
- subfolder - optional folder name (default
images). Ignored ifuse_subfoldersis off. - delimiter -
/,_,-, or\.
Two outputs: full_path (the joined string) and filename (the cleaned filename on its own). Wire full_path into a save-image node's filename field, or combine with a counter node for sequences.
The gotchas
First, the sanitize step silently strips invalid characters from all three strings - <>:"/\|?* get removed. That's usually good (no accidental path injection), but it means a slash inside your project name disappears rather than errors.
Second, and this is the one that bites: full_path is relative, not absolute. It's MyProject/images/image01, not /home/you/ComfyUI/output/MyProject/images/image01. Your save node resolves it against ComfyUI's output directory, so make sure the downstream node treats the string as a relative path. If a workflow shows a different absolute path than you expected, this is why.
Install
ComfyUI Manager (search "Chye ComfyUI Toolset"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/chyer/Chye-ComfyUI-Toolset
cd Chye-ComfyUI-Toolset
pip install -r requirements.txt
Restart ComfyUI. Pure-Python node, no per-node dependencies (the pack's requirements.txt still installs scipy/opencv-python alongside). Zip installs need .git/.cnr-id (Chye-ComfyUI-Toolset) per the README.
Verdict
If your save strategy is "type the path every time," this gives you a reusable, param-driven path you can change in one place. If you never think about your output folder structure, it's solving a problem you don't have. Either way it costs nothing to install - decide after trying it once.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| project_name | STRING | MyProject | β |
| filename | STRING | image01 | β |
| use_subfolders | BOOLEAN | true | β |
| delimiter | COMBO | / | 4 options: /, _, -, \ |
| subfolderopt | STRING | images | β |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| full_path | STRING | β |
| filename | STRING | β |