🗂️ 智绘_智能文件归档
Dry-run, copy, or move files between folders — with a trigger input that does nothing
- trigger_image
- log_info
ComfyUI is a weird place to organize files, and yet here we are: ZH_FileOrganizer (🗂️ 智绘_智能文件归档) is a node whose entire job is moving or copying files from one folder to another, with a text log out. It's the kind of node you use to sort an output dump - send the day's renders into dated subfolders, sweep caption sidecars next to their images, archive completed work out of your working directory. It's not an image-processing node at all; it's a file-management utility wearing a ComfyUI costume, triggered by your graph's run cycle.
How it works
It lists every file in source_path, decides a destination subfolder for each (by extension, per the pack's design), and then - depending on operation - either simulates, copies, or moves. Three modes, and the default is the wise one:
- Dry Run (仅模拟测试) - default. Logs what would happen, moves nothing. This is the mode you should always run first; the log tells you exactly which files land where before you commit.
- Copy (复制) -
shutil.copy2into the destination tree, originals stay. - Move (移动-慎用) -
shutil.move, and the "(慎用)" = "use with caution" in the label is the author's own warning. Files leave the source folder.
The optional trigger_image input is a deliberately odd design worth understanding: it doesn't get processed at all. It exists purely so you can connect something from your graph and use the node's execution as a "when this workflow runs, do the filing" hook. The source comment says it straight - "随便连个东西激活它,或者点击运行" (connect anything to activate it, or just click run). Output is a single log_info (STRING) that narrates the whole operation - source, destination, mode, moved/skipped counts - and it's an output node (OUTPUT_NODE = True), so the log shows up in your run results.
The inputs that matter
source_path and dest_path are the whole job - and both must exist, or the node returns a clean error log instead of doing anything. operation is your commit decision. Then trigger_image if you want it bound to a graph signal. The log string is what you read to verify.
Install
Part of the 智绘灵箱 (ComfyUI-ZhiHui) pack:
cd ComfyUI/custom_nodes
git clone https://github.com/zhuyungen/ComfyUI-ZhiHui.git
Restart ComfyUI (or ComfyUI Manager, "智绘灵箱" / "ComfyUI-ZhiHui"). Pure stdlib shutil/os - no extra deps.
Where people get burned
- Move is not undoable. shutil.move on a batch of files, and it's done. The "(慎用)" label is the author agreeing with me. Run Dry Run, read the log, then decide.
- It doesn't create missing folders for you. The node errors out if
dest_pathdoesn't exist (it checks upfront). Make the directory first, or the run just logs a refusal. - The trigger image does literally nothing to the files. It's a graph-hook, not an input. Wiring a real image into it expecting anything to happen to the image is a category error - the files are organized, the image is ignored.
- Extension-based filing is all you get. If you need content-aware sorting (by date, by model, by prompt), this isn't that - it's a simple extension-archiver, and the log is your only view into it.
For a "sweep the output folder into extension-organized subfolders" task, it's a clean fit - and the Dry Run default is genuinely the right call from the author. Just remember: the log string is your confirmation, and Move is the only irreversible choice in the box.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| source_path | STRING | — | |
| dest_path | STRING | — | |
| operation | COMBO | Dry Run (仅模拟测试) | 3 options: Dry Run (仅模拟测试), Copy (复制), Move (移动-慎用) |
| trigger_imageopt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| log_info | STRING | — |