GR Filename
Pull a folder name, filename, and extension out of a path string
- full_path
- last_folder
- filename_with_ext
- filename_no_ext
- custom
A small string-parsing utility: give it a file path, and it hands back the pieces you'd otherwise write string-manipulation nodes to extract yourself - the folder it's in, the filename with its extension, the filename without it, and the full path echoed back. It's the kind of node you don't think about until you're building an output-naming scheme that needs to reuse a piece of an input path, and suddenly you need exactly this.
How it works
Feed a path into file_path and it splits it into its component parts. custom is a second string input that isn't parsed at all - it comes back unchanged as its own output, which makes it a convenient place to carry an extra tag or label alongside the parsed path pieces without needing a separate node just to pass a string through your graph.
Practical use: take the path of an input image, pull last_folder out to use as part of your output filename (handy if you're organizing outputs by character, batch, or run name via folder structure), or take filename_no_ext and feed it into a Save Image node's filename prefix so your output naming tracks your input naming automatically.
The inputs and outputs that matter
file_path- the path string to parse. Works on the string itself; it doesn't need the file to actually exist on disk.custom- a pass-through string, unrelated to the parsing, that's useful for carrying an extra piece of text alongside the parsed output.
Five outputs: full_path (echoes the input), last_folder (the containing folder's name), filename_with_ext, filename_no_ext, and custom (echoes the custom input).
How to install it
Search GraftingRayman in ComfyUI Manager, or install manually:
cd ComfyUI/custom_nodes
git clone https://github.com/GraftingRayman/ComfyUI_GraftingRayman
Restart afterward. This pack requires OpenAI's CLIP installed as a separate step or nothing imports, and that applies here too even though this node is pure string parsing with no vision model involved - the whole pack shares one Python module. Portable ComfyUI: .\python_embeded\python.exe -m pip install git+https://github.com/openai/CLIP.git. System Python: pip install git+https://github.com/openai/CLIP.git.
Common issues & troubleshooting
Pack fails to load. Check your console at startup for the CLIP import error and run the pip install above.
last_folder comes back empty or wrong. Check that file_path actually includes a folder component - a bare filename with no directory in the path has nothing for this output to extract.
Extension handling looks off on a file with multiple dots. Filenames like image.v2.png can trip up naive extension-splitting logic in either direction - check filename_no_ext and filename_with_ext against your actual filenames before relying on this node in an automated naming pipeline.
Windows-style paths behave differently than expected. Path separators (\ vs /) can matter for how a path gets split into folder versus filename. If you're moving a workflow between Windows and Linux, double check file_path is actually using the separator your current OS expects.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| file_path | STRING | — | |
| custom | STRING | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| full_path | STRING | — |
| last_folder | STRING | — |
| filename_with_ext | STRING | — |
| filename_no_ext | STRING | — |
| custom | STRING | — |