Nodes/ComfyUI-LoRA-Backup/LoRA Backup (copy used LoRAs)
ComfyUI Node

LoRA Backup (copy used LoRAs)

Your LoRA folder is 400 GB. This button copies the six files that actually made the image.

By Slartibart23·Created 2 months ago·Updated a day ago· 2
LoRA Backup (copy used LoRAs)
  • trigger
  • report
◄target_folderD:/LoRA_Favorites►
◄keep_subfolderstrue►
◄skip_existingtrue►
◄auto_runfalse►

A workflow is not its LoRAs

The prompt, seed, checkpoint and every LoRA by name and hash are already inside the PNG's metadata. The LoRA files aren't. Your models/loras folder is years of downloads, most of it someone else's taste, and the combo that finally hit is maybe five files that happen to know each other.

Now you want that combo on the laptop, the portable drive, or a friend's install. So you open each loader, read the filenames off, hunt them down among thousands, and copy by hand - boring right up until you grab the wrong style_v3_final_fixed. After the CivitAI purges, wanting your working files somewhere you control stopped being paranoia. You don't need to hoard 9 TB - you need the six that worked.

What it does, mechanically

LoraBackup is one utility node with a button on it. Click, and the LoRAs currently enabled in the workflow land in a folder you picked. No generation, no queueing, nothing to wire.

The button is JavaScript in the pack's web/ folder. On click it calls app.graphToPrompt() - the same conversion ComfyUI does when it queues, so muted and bypassed nodes never make it into the payload - and POSTs the result to a route the pack registers at /lora_backup/copy. The server walks every node's inputs recursively, keeps any string ending in .safetensors, .ckpt, .pt, .pth or .bin that exactly matches a name in your loras list, and copies them with shutil.copy2 (timestamps preserved).

Two consequences matter:

  • It scans for file names, not node types. LoraLoader, LoraLoaderModelOnly, rgthree's Power Lora Loader, some exotic stacker - filename in the prompt, file gets copied. That's why it survives every pack churn.
  • Disabled entries are skipped: Power Lora Loader rows with on: false, dicts flagged enabled: false or switch: off. What gets copied is what the graph would actually have run.

The fields you touch

  • target_folder - default D:/LoRA_Favorites, i.e. the author's own machine. Change it immediately if you're not on Windows; forward slashes or doubled backslashes otherwise. Created if missing.
  • keep_subfolders (on) - recreates your loras subfolders in the target.
  • skip_existing (on) - skips files already there at the same byte size.
  • auto_run (off) - button-only by default; on, it also copies on every queue.

Optional trigger input of type *: nothing reads it, it's there so you can drag a wire from your decoded image to force ordering in auto mode. The only output is a STRING named report.

On auto_run: the node is an output node and its IS_CHANGED returns NaN, so it genuinely re-executes on every run, no caching. Handy for an unattended pipeline; mildly annoying mid-experiment, when half-finished combos pile up. Leave it off until you want it.

Installing it

Nothing to install here: no requirements.txt, no install.py, no models. Just the standard library and an aiohttp route ComfyUI already serves.

Search the pack name in ComfyUI Manager, or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/Slartibart23/ComfyUI-LoRA-Backup.git

Restart ComfyUI, then hard-reload the browser (F5). The button lives in web/lora_backup.js, and a stale frontend gives you a node with no button - indistinguishable from a broken install. Under utils as "LoRA Backup (copy used LoRAs)". MIT.

Where people get burned

  • "No active LoRAs found." Matching is exact against the loras list ComfyUI knows. A filename that no longer resolves - renamed since the workflow was saved - is silently ignored, not reported.
  • skip_existing compares size, not hashes. Same name, different size (a re-download) gets overwritten, which is usually what you want; same name and size from two different files is the case you'd never catch anyway.
  • It's additive, forever. Nothing is deleted or moved, so LoRAs you dropped from the workflow last week still sit in the target folder while the toast cheerfully says "0 copied, 6 already present". Prune by hand.
  • Permission and network-share failures are non-fatal. They show up as N errors in the toast, with a per-file line in the ComfyUI console. Read the console.
  • The endpoint is unauthenticated, like everything else in ComfyUI's API. It only copies out of your own loras directory, so it isn't a code-execution hole, but it does write to a caller-supplied path. Don't expose your instance to the internet - advice that predates this node.

The honest verdict

If both installs are yours and share a disk, a shared extra_model_paths.yaml pointing at one loras directory is the zero-copy answer, and this node isn't that. It's for a curated subset: the combo that just worked, exported after you saw the image, on its way to a USB stick, a render box, or someone else's machine. Different job - and the click-it-afterwards timing is exactly what makes it pleasant. Small niche, solved properly, with no dependencies to rot.

Categoryutils

Inputs (5)

NameTypeDefaultDescription
target_folderSTRINGD:/LoRA_Favorites—
keep_subfoldersBOOLEANtrue—
skip_existingBOOLEANtrue—
auto_runBOOLEANfalse—
triggeropt*—

Outputs (1)

NameTypeDescription
reportSTRING—