Copy Files ๐
Move or copy files by pattern, from inside your workflow
- copied_file_count
- log
This is a file-manager operation dressed up as a node: point it at a source folder, a destination folder, and a glob pattern, and it copies (or moves) everything that matches. If you've ever finished a batch generation and then alt-tabbed to your file explorer to shuffle the outputs somewhere, this puts that step inside the graph so it runs automatically.
It lives in ComfyUI-MieNodes (ComfyUI_MieNodes), MieMieeeee's utility pack, under the ๐ File Operations menu.
Why you'd reach for it
MieNodes started life as a dataset-wrangling toolkit for LoRA training, and this node still smells like it. When you're building a training set you're constantly herding files: pull the keepers into a clean folder, split images and caption .txt files, stage a batch for the next step. The KB's LoRA-training notes are blunt that dataset curation is most of the actual work, and anything that automates the boring file plumbing is worth having. Outside of training it's just as useful for collecting scattered outputs, archiving a run, or feeding a downstream node a tidy directory.
The reason to do it in-graph rather than in your OS is repeatability. A workflow that copies its own outputs to the right place every time is one you can hand to someone else, or run unattended, without a written "and then drag these over there" step.
How it works
You give it a source_directory and a destination_directory, plus a pattern like *.txt or *.png that decides which files get touched. It walks the source, matches the pattern, and copies each hit into the destination. Flip delete_origin on and it becomes a move instead of a copy. The node reports how many files it handled and a text log of what it did.
The mock flag is the smart part and you should use it. With mock on, the node runs the whole match-and-plan step but doesn't actually touch a single file - it just tells you what would happen. That's your dry run before you let it loose with delete_origin enabled.
The inputs and outputs that matter
Five required inputs, no optional ones:
source_directory/destination_directory(STRING) - absolute paths are safest. The defaults are placeholder text, so you must fill these in.pattern(STRING) - a glob, default*.txt. Use*.png,*.jpg,*for everything, and so on.delete_origin(BOOLEAN, default false) - off means copy, on means move.mock(BOOLEAN, default false) - dry run. Turn it on first.
Outputs are copied_file_count (INT) and log (STRING). Wire the log into a Show Any / text node so you can actually read what it did; wire the count into anything that wants to branch on "did we get files."
Installing it
ComfyUI Manager โ search ComfyUI-MieNodes โ install โ restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/MieMieeeee/ComfyUI-MieNodes
then restart. No model, no special dependencies. Nodes appear under ๐ MieNodes.
Common issues & troubleshooting
delete_origin is a move, and moves are not undoable. Run once with mock on, read the log, confirm the file list is what you expect, then turn mock off. This is the single mistake that will actually hurt you.
Zero files copied. Almost always a pattern or path problem. Check the glob (*.txt won't catch .TXT on a case-sensitive filesystem), and make sure the source path is real and absolute - a relative path resolves against wherever ComfyUI was launched, which is rarely where you think.
Nothing happens on re-run. If you already moved the files, the source is now empty and the second run legitimately copies nothing. Check the count output rather than assuming it broke.
It runs before the files exist. If you're copying this run's own outputs, make sure the copy fires after the save node - graph execution order isn't left-to-right. A trigger input on a downstream node, or simply wiring off the save result, keeps the ordering honest.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| source_directory | STRING | X://path/to/source | โ |
| destination_directory | STRING | X://path/to/destination | โ |
| pattern | STRING | *.txt | โ |
| delete_origin | BOOLEAN | false | โ |
| mock | BOOLEAN | false | โ |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| copied_file_count | INT | โ |
| log | STRING | โ |