DataSet_CopyFiles
The File Copier That Only Copies What You Actually Need
A file copier as a ComfyUI node sounds like a joke, but anyone who's assembled a training dataset by hand knows the chore it automates. DataSet_CopyFiles copies files from one folder to another - and, in its more interesting mode, only copies the ones that actually belong. It's the node that turns "drag 300 matching files into the right folder, by hand" into a single queue run.
You're not going to use this for everyday stuff. You'll reach for it when you're reconciling two folders - the classic case being a dataset where your images and captions drifted out of sync and you need to pull the missing pairs across.
The two copy modes
- BlindCopy - dumps every file in
source_folderintodestination_folder. Simple, no questions asked, existing same-named files get overwritten. Good for one-off "just move everything" operations. - CopyByDestinationFiles - the interesting one. It copies a file from the source only if a file with the same base name (ignoring extension) already exists in the destination, and only if that exact file isn't already there. So if your destination folder has
photo_001.pngand your source hasphoto_001.txt, the.txtgets copied across to sit next to its image.
That second mode is exactly what you want when your captions and images have gotten separated: it fills in the missing half of each pair without copying a single orphaned file.
Inputs
Only three, and they're self-explanatory strings:
- source_folder - where the files you want to copy live.
- destination_folder - where they should end up.
- copy_mode -
BlindCopyorCopyByDestinationFiles.
The destination folder is created if it doesn't exist. There are no outputs - it's a terminal/output node, so it belongs at the end of your graph and its only side effect is the filesystem.
Installing it
It comes with the ComfyUI-DataSet pack. The standard path:
cd ComfyUI/custom_nodes
git clone https://github.com/daxcay/ComfyUI-DataSet.git
cd ComfyUI-DataSet && pip install -r requirements.txt
Restart ComfyUI and it'll show up under the 🔶DATASET🔶 category. No models, no heavy dependencies - it's plain shutil, so it works the moment the pack loads. (The pip install step pulls in the pack's heavier charting libraries for the other nodes; this one doesn't need any of them.)
Common issues
The one to watch: BlindCopy overwrites same-named files without asking. If you're copying into a folder you care about and you're not 100% sure the names are clean, that's a real foot-gun. CopyByDestinationFiles is the safer habit - it refuses to overwrite and only moves matches.
Also note the modes are exact: it matches on base name across any extension, so if you're dealing with photo_001.png and photo_001.jpg both in the source, both are candidates and the second one to match wins the slot. If your dataset has a mix of file types with identical stems, glance at the console output - the node prints every copy it makes, so you can spot problems in the log rather than discovering them later in the training run.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| source_folder | STRING | directory path | — |
| destination_folder | STRING | directory path | — |
| copy_mode | COMBO | 2 options: BlindCopy, CopyByDestinationFiles |
Outputs (0)
No outputs