From 871cffeab3ea5616a052d2133883fa0228b2ed7f Mon Sep 17 00:00:00 2001 From: niknah Date: Wed, 22 Jul 2026 08:51:31 +1000 Subject: [PATCH] Make the list of files relative to input folder --- Spreadsheet2VideoNodes.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Spreadsheet2VideoNodes.py b/Spreadsheet2VideoNodes.py index 061e6c4..1cb951b 100644 --- a/Spreadsheet2VideoNodes.py +++ b/Spreadsheet2VideoNodes.py @@ -591,7 +591,7 @@ class Spreadsheet2VideoFilesList(io.ComfyNode): node_id="Spreadsheet2VideoFilesList", display_name="Spreadsheet2Video Files list", category="Spreadsheet2Video", - description="Get a list of files", + description="Get a list of files relative to the input folder", search_aliases=["spreadsheet", "loop", "load", "files"], inputs=[ io.String.Input("directory", default="input", tooltip="Directory. example: input, output"), @@ -608,15 +608,18 @@ class Spreadsheet2VideoFilesList(io.ComfyNode): found = [] if regex: findRe = re.compile(find, re.IGNORECASE) - for dirpath, dirnames, filenames in os.walk(directory): + for dirpath, dirnames, filenames in os.walk( directory): for filename in filenames: # Check if the regex pattern matches the filename - file = str(Path(os.path.join(dirpath, filename)).relative_to(directory)) + file = Path(os.path.join(dirpath, filename)) if findRe.search(file): found.append( file ) else: found = list(glob.iglob( str(Path(directory) / find), recursive=True)) - found = [ str(Path(f).relative_to(directory)) for f in found ] + found = [ Path(f) for f in found ] + + input_folder = Path(folder_paths.get_input_directory()) + found[:] = [ str(f.absolute().relative_to(input_folder)) for f in found] return io.NodeOutput( "\n".join(['filename'] + found)