Nodes/comfy-ovum/os.path.split (all)
ComfyUI Node

os.path.split (all)

The whole path, broken into every piece

By sfinktah·Created about a year ago·Updated 10 months ago· 7
os.path.split (all)
  • path_in
  • parts
path

os.path.split gives you two pieces. This node gives you all of them. os.path.split (all) is comfy-ovum's extension - the Python stdlib doesn't have a "split everything" function, so the pack wrote one that repeatedly splits until there's nothing left and returns every component as a list. C:\renders\frames\seq\frame_0072.png becomes ['C:', 'renders', 'frames', 'seq', 'frame_0072.png'].

It lives in the ovum/path/os.path family of comfy-ovum, sfinktah's utility pack. Note the display name has "(all)" in it - that's how you'll find it in the node menu, distinct from the plain os.path.split.

How it works

Takes a path and repeatedly applies os.path.split, collecting each tail component until nothing's left, then returns them in order as a LIST (parts). Path from:

  • path (STRING, required): the widget.
  • path_in (PATHLIKE,STRING, optional): link-only; overrides the widget when connected.

One LIST output. Pure string surgery - no filesystem access, safe on non-existent paths. The list preserves top-to-bottom order: the drive or root comes first, the filename last.

Where you'd use it

  • Path reconstruction and reordering. Grab component [-1] (the filename) or [0] (the drive), or drop the middle segments and os.path.join the rest back together. This is the node that makes "take the filename from this path and the folder two levels up" a two-node operation instead of a chain of splits.
  • Conditional logic on depth. len(parts) tells you how deep a path is; you can branch on "is this output nested two folders or three?" - useful for normalizing a mess of differently-shaped paths before routing.
  • Wildcard-ish matching. Index into the list to test "is the second-to-last component frames?" without regex - though for real pattern matching the pack's regex nodes are the stronger tool.

The output plugs straight into comfy-ovum's list utilities (List Slice, List Join, Repeat Item, etc.), so you can manipulate the pieces with the same pack's data nodes before rejoining.

Installing it

Pack-wide, once:

cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/comfy-ovum

Or ComfyUI Manager → "comfy-ovum" → Install → restart. No models, no extra deps.

Gotchas

  • It's an extension, not stdlib. Because the function is the pack's own, edge-case behavior is worth a quick sanity test on your platform - especially Windows drive handling, where C: shows up as its own first element (['C:', ...]) because that's what repeated split yields. That's faithful to os.path.split semantics, but it means the first element isn't always what you'd call a "folder."
  • Empty-string edges. A trailing separator can produce an empty tail component in the list. If you're indexing by position, clean with os.path.normpath first.
  • Order matters. It's top-down (root → filename), which is the reverse of what a stack-style splitter would give you. Index [-1] for the filename, [0] for the root.

If you've ever wanted to grab "the folder two up from this file" without three nested split nodes, this is the node that saves you. One list, all the pieces, index what you need.

Categoryovum/path/os.path

Inputs (2)

NameTypeDefaultDescription
pathSTRING
path_inoptPATHLIKE,STRING

Outputs (1)

NameTypeDescription
partsLIST