Nodes/ComfyUI Easy Use/Remove Local Image
ComfyUI Node Runs on cloud

Remove Local Image

Delete an image file from disk mid-workflow

By yolain·Created 3 years ago·Updated 9 days ago· 2,633
Remove Local Image
  • any
    file_name

    Housekeeping, as a node. It deletes a named image file from your local disk as part of the workflow run. That's a niche thing to want in a graph, but it has one very real home: loops and long batch jobs that generate intermediate files you don't want to keep. If each iteration writes a temp image, uses it, and moves on, those temps pile up fast - this node is how you sweep them as you go instead of drowning in scratch files afterward.

    Why you'd reach for it

    The honest answer is: mostly inside automated pipelines. A few concrete cases:

    • Loop cleanup. You save a working image each pass so a downstream tool can read it, then delete it once you're done with it - so a 500-iteration job doesn't leave 500 orphaned files.
    • Temp-file discipline. Any workflow that stages an image to disk as a handoff between steps and wants to clean up behind itself.
    • Managing a constrained disk. On a small or ephemeral instance, deleting intermediates keeps you from filling the volume mid-run.

    For interactive, one-off work you almost never need this - you'd just delete files yourself. Its value shows up when the workflow is doing the file management for you.

    The inputs and outputs

    • any (any type) - a trigger input. It doesn't get deleted; it's there so the node has an upstream dependency and therefore runs after whatever produced or last used the file. This ordering is the point - you want the delete to happen once the file's job is done, not before.
    • file_name (STRING) - the file to remove.

    There's no output - it's a terminal node whose entire effect is the side effect on your filesystem.

    Installing it

    ComfyUI Manager: search ComfyUI Easy Use, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yolain/ComfyUI-Easy-Use
    

    then install the requirements (install.bat on Windows, else pip install -r ComfyUI-Easy-Use/requirements.txt) and restart.

    Common issues

    • This actually deletes files - there's no undo. Point file_name at the wrong thing and it's gone. Double-check the name and path before you wire this into an automated loop, and don't aim it at anything you can't regenerate.
    • Execution order is everything. If the delete fires before the step that reads the file, that step fails. The any trigger exists precisely to sequence this correctly - wire it so the node depends on whatever must finish with the file first.
    • Path resolution. Like other file nodes, it operates on the path as ComfyUI's server sees it, not your local machine if you're on a remote/cloud instance. Get the path right for that environment.
    • A missing file. Asking it to delete something that isn't there does nothing useful and may log an error - make sure the file was actually written before you try to remove it.
    CategoryEasyUse/Image

    Inputs (2)

    NameTypeDefaultDescription
    any*
    file_nameSTRING

    Outputs (0)

    No outputs