Multiple text files export

Hello good people!
Does anyone know how to export multiple text files from Grasshopper where information of each branch of the tree is written to its own text file? I am trying to export seperate gcode files.
Thanks in advance.

Is it always the same number of files?

It’ll be pretty trivial with a script component. The attached file contains one which pairs up file paths and lists of strings (one per line).

write files.gh (5.7 KB)

1 Like

Hello David,
Thanks for the quick reply and the script. To answer your question: the number of files would need to depend on the number or branches in the tree (one level tree). I am looking for something that would have data tree inputs for:

  1. File contents
  2. File name
    and additionally inputs for: folder to export, file extension, input for triggering export function and boolean input for overwrite.
    (both file contents and file name inputs would need to have the same amount of branches obviously)

I am not a programmer myself and I started learning grasshopper around half a year ago so I consider myself still a rookie. If you think think you could write a script to help me with that I would gladly and respectably reward you in some way.
P.S.Closest thing that I found is FabTools’ “Write to CSV” component, but the problem with it is that even though it export multiple files with correct file names and extentions, it puts information of all data tree branches into each file - you end up with multiple files with the same content