Nodes/ComfyUI-FilePathCreator/File Path Extractor
ComfyUI Node

File Path Extractor

One node that tears a file path into its parts

By HECer·Created 2 years ago·Updated 3 months ago· 14
File Path Extractor
    • File Name
    • File Extension
    • File Name With Extension
    • Folder Name
    • Folder Path
    • Parent Directory
    path

    Somewhere in a real workflow you'll get handed a full path - from a Load Image, a folder-listing node, or a text field - and what you actually want is just the filename, or just the folder it lives in. File Path Extractor is the node that takes one path (or a whole list of them) and splits it into six useful parts: File Name, File Extension, File Name With Extension, Folder Name, Folder Path, and Parent Directory. Feed it C:/Folder/FolderName/Filename.png and you get Filename, png, Filename.png, FolderName, C:/Folder/FolderName, and C:/Folder out the other side. It's the kind of boring utility that earns its keep the moment you build a workflow that names, sorts, or re-saves files based on where they came from - say, extracting the stem to feed a filename-conditioned prompt, or rebuilding a path into a different folder.

    Mechanically it's Python's os.path functions applied per path: dirname, basename, splitext. The extension comes back without the leading dot, and if a path has no directory segment, Folder Path just returns the original text. Note the README only lists five outputs - the node actually ships six, with Parent Directory being the extra one. The interesting design bit is that it's list-native: the node declares INPUT_IS_LIST and every output is a list, so it plays nicely with ComfyUI's batch/list processing. Feed it a list of paths and each output socket gets one value per input, all kept in order.

    You only set one input, path (a multiline string, blank by default - paste a path or wire one in). Everything else is outputs.

    Grounded gotchas from how it actually behaves:

    • The extension output has no dot - png, not .png. If you're rebuilding a path, re-add it yourself.
    • A file with no extension returns an empty File Extension and the whole name in File Name; feeding it a directory path means "File Name" reflects the last folder segment instead.
    • Path handling uses whatever separator your OS expects - the README's examples use forward slashes, which is fine on Linux/macOS and most Windows tooling, but don't expect it to translate \ backslashes across platforms.
    • It's pure string math with no I/O - fast, and like its sibling it re-executes every run because the pack forces IS_CHANGED to true, so it never goes stale in a queue.

    Install is the same as File Path Creator - they ship together in one pack, so you get both at once. ComfyUI Manager → search "ComfyUI-FilePathCreator", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/HECer/ComfyUI-FilePathCreator
    

    Then restart. No models, no dependencies, MIT license. If you've been squinting at full paths trying to remember which segment is which, this is the no-brainer install.

    CategoryFilePath Utils

    Inputs (1)

    NameTypeDefaultDescription
    pathSTRING

    Outputs (6)

    NameTypeDescription
    File NameSTRING
    File ExtensionSTRING
    File Name With ExtensionSTRING
    Folder NameSTRING
    Folder PathSTRING
    Parent DirectorySTRING