ComfyUI > Nodes > DJZ-Nodes > Load Text Directory

ComfyUI Node: Load Text Directory

Class Name

LoadTextDirectory

Category
text
Author
DriftJohnson (Account age: 4052days)
Extension
DJZ-Nodes
Latest Updated
2025-04-25
Github Stars
0.04K

How to Install DJZ-Nodes

Install this extension via the ComfyUI Manager by searching for DJZ-Nodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter DJZ-Nodes 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

Load Text Directory Description

Facilitates loading and managing text files from specified directory for AI tasks with flexible selection modes.

Load Text Directory:

The LoadTextDirectory node is designed to facilitate the loading and management of text files from a specified directory. This node is particularly useful for AI artists and developers who need to process or analyze large batches of text files efficiently. By allowing you to specify a directory and a pattern for file selection, the node can retrieve text content based on different modes such as single file, incremental file, or random selection. This flexibility makes it an essential tool for tasks that require dynamic text input, such as training AI models or generating text-based art. The node ensures that only valid text files with specified extensions are considered, providing a streamlined and error-free experience.

Load Text Directory Input Parameters:

mode

The mode parameter determines how text files are selected from the directory. It offers three options: single_file, incremental_file, and random. In single_file mode, a specific file is selected based on the provided index. Incremental_file mode allows for sequential file selection, starting from the given index and looping back to the beginning if the end is reached. The random mode selects a file randomly, using the provided seed for reproducibility. This parameter is crucial for controlling the file selection process and adapting it to your specific needs.

seed

The seed parameter is an integer used to initialize the random number generator when the random mode is selected. It ensures that the random selection of text files is reproducible, meaning the same seed will always result in the same file being selected. The default value is 0, and it can range from 0 to 18,446,744,073,709,551,615. This parameter is important for maintaining consistency in experiments or projects that require random file selection.

index

The index parameter specifies the position of the text file to be loaded when using the single_file or incremental_file modes. It is an integer with a default value of 0, and it can range from 0 to 150,000. This parameter allows you to target specific files within the directory, providing precise control over which text content is loaded.

label

The label parameter is a string that serves as an identifier for the batch of text files being processed. It has a default value of Text Batch 001 and is not multiline. This parameter is useful for organizing and labeling different sets of text files, especially when dealing with multiple batches or experiments.

path

The path parameter is a string that specifies the directory path where the text files are located. It is not multiline and must be provided for the node to function. This parameter is essential as it directs the node to the correct location to load the text files.

pattern

The pattern parameter is a string that defines the file pattern to match when searching for text files in the specified directory. The default value is *, which matches all files. This parameter allows you to filter files based on specific naming conventions or extensions, ensuring that only relevant files are processed.

Load Text Directory Output Parameters:

text

The text output parameter provides the content of the text file that has been loaded. This string output is the primary data you will work with, whether for analysis, processing, or feeding into an AI model. It represents the actual text content extracted from the selected file.

filename_text

The filename_text output parameter returns the name of the text file that has been loaded. This string output is useful for tracking which file the text content originated from, aiding in organization and documentation of the files being processed.

Load Text Directory Usage Tips:

  • Ensure the path parameter is correctly set to the directory containing your text files to avoid errors related to non-existent paths.
  • Use the pattern parameter to filter files by specific extensions or naming conventions, which can help in managing large directories with mixed file types.
  • When using random mode, set a specific seed value to ensure reproducibility in experiments or projects that require consistent random file selection.

Load Text Directory Common Errors and Solutions:

Path does not exist: <path>

  • Explanation: This error occurs when the specified directory path does not exist or is incorrect.
  • Solution: Verify that the path parameter is set to a valid directory path and that the directory exists on your system.

No valid text file found for index <index>

  • Explanation: This error indicates that there is no text file at the specified index in the directory.
  • Solution: Check the index parameter to ensure it is within the range of available files. Adjust the index or verify the directory contents.

No valid text file found

  • Explanation: This error occurs when no text files match the specified pattern or when the directory is empty.
  • Solution: Ensure that the pattern parameter is correctly set to match the desired text files and that the directory contains files with the allowed extensions.

Load Text Directory Related Nodes

Go back to the extension to check out more related nodes.
DJZ-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 Playground, enabling artists to harness the latest AI tools to create incredible art.