Nodes/ComfyUI-SimpleUtils/Filesystem > DeleteInputFile
ComfyUI Node

Filesystem > DeleteInputFile

ComfyUI's input folder is a landfill, and this node deletes one file from it

By moonstar-x-libs·Created 16 days ago·Updated 6 days ago· 1
Filesystem > DeleteInputFile
  • passthrough
  • PASSTHROUGH
◄filename▾►

Every image you drag into ComfyUI gets copied into ComfyUI/input/. Not linked - copied. And nothing ever deletes it. That's how you end up like the r/StableDiffusion poster who found three gigabytes of forgotten IPAdapter references and inpainting masks in a folder they didn't know existed. The usual fix is a line in your launch script that nukes the whole directory before startup, which works right up until it eats a mask some workflow depended on.

SimpleUtilsDeleteInputFile (menu name Filesystem > DeleteInputFile) is the scalpel version: one file, deleted at a specific point in the graph, after the node that reads it has already read it.

What it actually does

It lives in ComfyUI-SimpleUtils, a small MIT-licensed pack from moonstar-x that also ships base64 image/audio converters. This node is about twenty lines of real logic, and the interesting part is what it refuses to do.

The filename widget is a dropdown, and that list is built by walking ComfyUI's input directory recursively - so subfolders show up as paths like nested/image.png, with forward slashes and sorted. Paths are resolved relative to that directory, and anything that escapes it gets rejected: .. segments, absolute paths, a symlink pointing at your models folder (that last kind never even shows up in the list). Then it checks the target is actually a file - a directory raises instead of vanishing - and calls Python's unlink(). That last bit matters: it's a real delete, not a trip to the trash. No undo, no recycle bin.

One more structural detail worth knowing: the node registers as an output node (OUTPUT_NODE = True), which in ComfyUI means it always runs even though nothing downstream consumes it. That's what lets it act as a graph terminal whose only job is a side effect - same category as SaveImage, just destroying instead of writing.

The two fields that matter

filename is the one you set, and the only one you set. It's a combo listing every file currently in input/.

passthrough is optional and typed as the wildcard * - the author implements that with a string subclass that lies to ComfyUI's type check and reports a match against everything, the standard trick plumbing nodes use so one socket accepts an IMAGE, a MODEL or a number. It comes back out as PASSTHROUGH, unchanged, or as None if you left it unwired.

That passthrough isn't decoration; it's the ordering mechanism. ComfyUI executes a node's inputs before the node, so hanging LoadImage's IMAGE output into passthrough guarantees the file was loaded into memory before it gets deleted. Chain PASSTHROUGH into whatever should only run once the file is gone and you've got a readable statement of intent: read this, then bin it.

Installing it

Manager is the sane path: search ComfyUI-SimpleUtils in ComfyUI Manager and install, or use the registry directly:

comfy node install comfyui-simpleutils

Manual, if you prefer:

cd ComfyUI/custom_nodes
git clone https://github.com/moonstar-x-libs/ComfyUI-SimpleUtils.git

Restart ComfyUI. The declared dependencies are av, numpy, pillow and torch - a current ComfyUI install already has all four - and there are no model downloads of any kind. A nice change from the usual custom-node ritual of pulling 6GB before you see a single node.

Where people get burned

The dropdown goes stale. The file list is computed when ComfyUI hands the frontend its node definitions, so a file you just dropped in - or one another workflow wrote during a run - won't appear until you reload the page or hit Refresh. If your new upload is "missing" from the list, that's why, and it isn't a bug.

It's not re-queueable. Delete the file, then hit Queue again, and the whole prompt fails - LoadImage no longer has a valid option, and the widget's saved value points at a file that isn't in input/ any more. That's the honest cost of the node, and it's the same trade-off the people who rm -rf their input folder make, just scoped to one file. Use it at the end of a throwaway ingest workflow, not in the middle of a graph you're going to iterate on.

One file per node. filename is a fixed dropdown of real filenames - no globs, no prefixes, no "delete everything older than a day." Cleaning 200 files means 200 nodes. If bulk cleanup is the goal, a startup script or a scheduled find -mtime is still the right tool.

Wrong directory. It only touches input/. Your output/ and temp/ folders - where SaveImage and PreviewImage pile up real gigabytes - are out of reach here. Different problem, different node.

The pack is tiny and young with no search traffic, so expect no tutorials and no bug-report trail. What's there is small and well tested - pytest suite, registry publishing - and for a node whose job is irreversible deletion, a boring well-scoped implementation is what you want.

CategorySimpleUtils/Filesystem

Inputs (2)

NameTypeDefaultDescription
filenameCOMBOThe file to delete, relative to the input directory.
passthroughopt*Any value, returned unchanged. The file is only deleted once this value is available.

Outputs (1)

NameTypeDescription
PASSTHROUGH*—