From ad1102fc1d038ad930cf8373dae5d8d37bf74fc0 Mon Sep 17 00:00:00 2001 From: rewolf <201693+rewolf@users.noreply.github.com> Date: Wed, 12 Mar 2025 09:43:09 +0900 Subject: [PATCH] Modify LoadImage node to also traverse subdirectories of the input directory Previously the LoadImage node only displayed direct file contents. This change traverses the full directory tree under the `input_dir` using `os.walk`, including symlinks. --- nodes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nodes.py b/nodes.py index 63791e208..4ef13203f 100644 --- a/nodes.py +++ b/nodes.py @@ -1648,7 +1648,8 @@ class LoadImage: @classmethod def INPUT_TYPES(s): input_dir = folder_paths.get_input_directory() - files = [f for f in os.listdir(input_dir) if os.path.isfile(os.path.join(input_dir, f))] + strip_inputdir = lambda path: path[len(input_dir)+1:] + files = [strip_inputdir(os.path.join(dir,f)) for (dir, subdirs, files) in os.walk(input_dir, followlinks=True) for f in files] return {"required": {"image": (sorted(files), {"image_upload": True})}, }