ComfyUI  >  Nodes  >  ControlFlowUtils >  📁 Folder Search

ComfyUI Node: 📁 Folder Search

Class Name

FolderSearch

Category
🐺 VykosX-ControlFlowUtils
Author
VykosX (Account age: 2024 days)
Extension
ControlFlowUtils
Latest Updated
10/1/2024
Github Stars
0.1K

How to Install ControlFlowUtils

Install this extension via the ComfyUI Manager by searching for  ControlFlowUtils
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ControlFlowUtils 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
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

📁 Folder Search Description

Scan specified folder for files matching pattern, useful for managing large collections, supports recursive searches and log file saving.

The FolderSearch node is designed to scan a specified folder for files that match a given pattern. This node is particularly useful for AI artists who need to manage and organize large collections of files, such as images or datasets, by automating the search process. By specifying a folder path and a search mask, you can efficiently locate files that meet your criteria. The node supports recursive searches, allowing you to include subfolders in your scan, and can return either the full file paths or just the filenames. Additionally, you can choose to save the search results to a log file for further processing. This node simplifies file management tasks, making it easier to handle large volumes of data without manual intervention.

📁 Folder Search Input Parameters:

folder_path

This parameter specifies the directory you wish to scan. You can set it to an absolute path or a relative path from ComfyUI's root folder. The folder_path determines the starting point of the search. The default value is /.

search_mask

This parameter defines the pattern used to match files. The pattern can include wildcards such as * to match any number of characters, ? to match a single character, and # to match a single numeric character. You can also use brackets to specify character sets or ranges, such as [a-z]. The default value is *.*.

output_type

This boolean parameter determines how the search results are returned. If set to True, the node returns the entire list of matching files. If set to False, it returns one file at a time with each execution until all files are processed. The default value is False.

recursive

This boolean parameter specifies whether the search should include subfolders within the main directory. If set to True, the node will scan all subfolders recursively. The default value is True.

include_directories

This boolean parameter indicates whether directories should be included in the search results. If set to True, both files and directories that match the search mask will be returned. The default value is False.

return_full_path

This boolean parameter determines whether the full file paths should be returned or just the filenames and extensions. If set to True, the full paths are returned. The default value is False.

relative_filenames

This boolean parameter specifies whether the filenames should be returned relative to the search directory. If set to True, the filenames will include their parent folder relative to the search directory. The default value is False.

save_output_to

This optional parameter allows you to specify a file path where the search results will be saved. If provided, the node will write the search results to this log file. The default value is an empty string, meaning no log file is created.

📁 Folder Search Output Parameters:

file

This output parameter returns the search results based on the output_type setting. If output_type is True, it returns a list of all matching files. If output_type is False, it returns one file at a time until all files are processed. If no files are found, it returns an empty string.

📁 Folder Search Usage Tips:

  • To scan a folder and all its subfolders for all files, set folder_path to the desired directory and search_mask to *.*.
  • Use the recursive parameter to include subfolders in your search, which is useful for deeply nested directories.
  • Set return_full_path to True if you need the complete file paths for further processing or logging.
  • Utilize the save_output_to parameter to save the search results to a log file, which can be helpful for auditing or batch processing tasks.

📁 Folder Search Common Errors and Solutions:

"Invalid folder path"

  • Explanation: The specified folder path does not exist or is not accessible.
  • Solution: Ensure that the folder path is correct and that you have the necessary permissions to access it.

"No files found matching the pattern"

  • Explanation: No files in the specified folder match the search mask.
  • Solution: Verify the search mask and ensure it correctly represents the files you are looking for. Adjust the pattern if necessary.

"Error writing to log file"

  • Explanation: The node encountered an issue while trying to write the search results to the specified log file.
  • Solution: Check the file path and ensure you have write permissions. Make sure the file is not open in another program.

"Final file reached"

  • Explanation: The node has processed all files matching the search criteria.
  • Solution: This is an informational message indicating that the search is complete. No action is needed.

📁 Folder Search Related Nodes

Go back to the extension to check out more related nodes.
ControlFlowUtils
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.