Save 4 hours! We auto-setup your workflow! Free!

Drop your workflow.json — we handle every dependency, custom node, and model. Just open the link and run.

Auto-Setup Workflow Json (Free) Now!
ComfyUI > Nodes > ComfyUI-Get-Random-File

ComfyUI Extension: ComfyUI-Get-Random-File

Repo Name

ComfyUI-Get-Random-File

Author
chriscoletech (Account age: 0 days)
Nodes
View all nodes(1)
Latest Updated
2026-11-03
Github Stars
0.0K

How to Install ComfyUI-Get-Random-File

Install this extension via the ComfyUI Manager by searching for ComfyUI-Get-Random-File
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-Get-Random-File in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

ComfyUI-Get-Random-File Description

ComfyUI-Get-Random-File selects random files or images from folders, loads images by index, extracts embedded prompts, and saves images or videos to custom folders outside ComfyUI's output directory.

ComfyUI-Get-Random-File Introduction

ComfyUI-Get-Random-File adds nodes for choosing files and images from folders, retrieving an image by its index, and saving images or videos to a folder you choose. It can help you build workflows that try different source images or work with files outside ComfyUI’s usual output folder.

Some nodes return a file path, which is the location of a file on your computer. The image-selection nodes also return an IMAGE you can connect to another node. Those two outputs serve different purposes: use the image when the next step needs to work with its pixels, and use the path when the next step needs to know where the file came from.

How ComfyUI-Get-Random-File Works

Think of a folder as a collection of source material for a project. Random File Path chooses one file from that collection and tells the rest of your workflow where it is. Random Image Path does something similar for an image, but also supplies the image itself. When you need to select an image by its position in a folder instead of making a random choice, use Get Image File By Index.

The image-selection nodes can also read prompts stored in an image’s embedded ComfyUI workflow metadata. For example, if you select a PNG created by a ComfyUI workflow, you may be able to pass its original positive and negative prompts to later nodes. If the selected image has no embedded prompts, those outputs are empty.

The saving nodes handle the other end of a workflow: they write a resulting image or video to a folder on your computer.

ComfyUI-Get-Random-File Features

  • Random File Path chooses a random file from a specified directory and returns its path as a STRING. Use it when another node needs a file location rather than an image loaded into the workflow.
  • Get Image File By Index retrieves an image from a specified directory by index. It returns the IMAGE and its file path as a STRING, giving you both the image to process and its location.
  • Random Image Path chooses a random image file from a directory. It returns the IMAGE and its file path as a STRING, making it useful when you want to vary the source image used by a workflow.
  • Prompt metadata outputs are available on Random Image Path and Get Image File By Index. Each provides positive_prompt and negative_prompt strings extracted from embedded ComfyUI workflow metadata when available. The author describes support for prompts found through titled prompt nodes, sampler or guider connections, parallel chains, injected graphs, combined preparation nodes, several ComfyUI text encoders, and text-concatenation or wildcard nodes. An image without embedded prompts, or a non-PNG image, returns empty prompt strings.
  • Save Image to Folder saves images to a folder you choose, including one outside ComfyUI’s output directory. It creates the folder if needed and uses a numbered, stock-style _00001_ counter to avoid overwriting an existing file. PNG saves embed workflow metadata. The node also supports stock prefix variables such as %width% and %date for naming output files.
  • Save Video to Folder saves a VIDEO input to a folder you choose using ComfyUI’s video writer. Compatible streams are copied; the video is re-encoded when the requested format, codec, or CRF requires it.

Node previews

Random File Path

Random File Path preview

Random Image Path

Random Image Path preview

Get Image File By Index

Get Image File By Index preview

The original README also includes a preview labeled “Get Video By Index”, but does not describe that node’s inputs or outputs.

Troubleshooting ComfyUI-Get-Random-File

I expected an image, but I only have a file path. What should I use?
Check which node you selected. Random File Path returns a path as a STRING; it does not return an IMAGE. Use Random Image Path for a random image, or Get Image File By Index to retrieve an image by index.

Why are the positive and negative prompt outputs empty?
First, check whether the selected image is a PNG with embedded ComfyUI workflow metadata. The author notes that images without embedded prompts and non-PNG files return empty strings. An empty output does not necessarily mean that image selection failed.

How do I keep a new image from replacing an earlier result?
Use Save Image to Folder. Its numbered filename counter avoids overwriting existing files.

Can I save outside ComfyUI’s usual output directory?
Yes. Save Image to Folder and Save Video to Folder are described as accepting a folder anywhere on your computer. Save Image to Folder also creates its destination folder if it does not exist.

Why might saving a video take longer than simply copying it?
Save Video to Folder copies compatible streams, but re-encodes when the chosen format, codec, or CRF requires it.

Learn More about ComfyUI-Get-Random-File

Visit the ComfyUI-Get-Random-File repository for the project’s README and node previews. The previews can help you recognize the nodes when assembling an image-selection workflow.

ComfyUI-Get-Random-File Related Nodes

RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

ComfyUI-Get-Random-File detailed guide | ComfyUI