文件夹读取器
Point it at a folder, get back its filenames, images, and captions as lists
- 文件名称列表
- 文件总数
- 图片
- 文本
Most ComfyUI file loading is single-file: you pick one image, you get one image. MuyeFileReader is the folder version. Give it a path - a directory or a single file - and it lists the contents, sorts them, and hands you back the filenames, the total count, the images loaded as a batch, and any text files read in as strings. If you've ever wanted to load "all the images in this folder, in order, with their caption sidecars," this is the node you were missing.
Its natural home is training-data prep. A LoRA dataset is a folder of images with same-basename .txt captions - the KB's training material notes that sidecar convention is what every trainer reads. Wire MuyeFileReader to that folder and you get images as an IMAGE list and captions as a STRING list in the same run, sorted consistently, ready to feed a caption-fixing node (BatchTextReplace in this same pack) and a saver (SaveFilesToLocal). It also works for batch generation: load a folder of reference images and process them all.
The 路径 input takes a full path - the tooltip's example is a Windows output dir like F:\ComfyUI_windows_portable\ComfyUI\output\娜然. Absolute paths work; if the path doesn't exist, it also tries matching against ComfyUI's input/ and output/ directories by basename. The other inputs are all selection and ordering:
- 文件名称输出序号 / 图像输出序号 / 文本输出序号 - three independent index filters.
0means everything; otherwise1,3,5or1-10style ranges pick specific files from the sorted list. So you can output all filenames but only the third image. - 去掉文件名称后缀 - strip
.png/.txtextensions from the filename list (handy for pairing with sidecars). - 输出排序方式 - by filename (natural sort, so
img2sorts beforeimg10), modified date, file size, image resolution, or file type - plus 排序规则 for ascending/descending.
Outputs: 文件名称列表 (STRING list), 文件总数 (INT), 图片 (IMAGE list, auto-converted to RGB tensors), 文本 (STRING list, utf-8). It reads common image types and text types (txt/csv/json/xml/yaml/md).
Install
ComfyUI Manager → search "muye" → install "ComfyUI-Muye-nodes", restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/muyexiuluo/ComfyUI-Muye-nodes
cd ComfyUI-Muye-nodes
pip install -r requirements.txt
then restart. Note the README's manual block shows an older ComfyUI_Muye.git URL; use the -nodes one above.
The torchaudio gotcha
This is the one real trap in the pack. The module imports torchaudio at the top, unconditionally - but requirements.txt lists torchaudio as optional ("not installed, can't read audio files"). Because the pack's loader skips any module that fails to import, if you don't have torchaudio, this node silently doesn't exist - no image or text loading either, not just no audio. If MuyeFileReader is missing from your menu after install, pip install torchaudio is the fix, even if you never read audio. Console check: [Muye] Failed to load module ... file_reader confirms it. Labels are Chinese by design (display name 文件夹读取器).
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| 路径 | STRING | 输入文件或文件夹的完整路径(如 F:\\ComfyUI_windows_portable\\ComfyUI\\output\\娜然) | |
| 文件名称输出序号 | STRING | 0 | 输入序号,如'1,3,5'或'1-10',0表示全部 |
| 去掉文件名称后缀 | BOOLEAN | false | 启用时,输出的文件名称将移除扩展名(如 .png、.txt 等) |
| 图像输出序号 | STRING | 0 | 输入序号,如'1,3,5'或'1-10',0表示全部 |
| 文本输出序号 | STRING | 0 | 输入序号,如'1,3,5'或'1-10',0表示全部 |
| 输出排序方式 | COMBO | 文件名称 | 5 options: 文件名称, 修改日期, 文件大小, 图像分辨率, 文件类型 |
| 排序规则 | COMBO | 正序 | 2 options: 正序, 倒序 |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| 文件名称列表 | STRING | — |
| 文件总数 | INT | — |
| 图片 | IMAGE | — |
| 文本 | STRING | — |