i found a solution in a different thread, i will link it here:
This allowed me to iterate over the files.
I have since built out a complex workflow with the amazing help of the forum mods and the custom javascript that we all struggle with.