Hi,
I am trying to build a workflow to get or create Google Drive folder. The idea is to give the workflow a path “path/to/a/folder” and a root folder id (parent). The workflow should find “path” folder inside the root folder, if it does not exists, it creates it. Then it should find the “to” folder inside the “path” folder. Etc, etc.
I started the workflow by a function which splits on “/” and then pass the items to the SplitInBatches node. I configured the nodes which check if the folder exists and create it if it does not. However, I am struggling with the parent Id which must be set by the previous batch execution (and fallback to the root folder if no previous exec).
Thanks
I knew that formalizing my question would help me to understand better the flow 
I realized that $node["SplitInBatches"].context["items"]
contains only the remaining items, not the full list. So I simply need to check if anything remains and if so, to alter the first item parent:
if ($node["SplitInBatches"].context["items"].length) {
$node["SplitInBatches"].context["items"][0].json.parent = $json.id
}
Hey @vbouchet31!
Is that the solution that you’re using? Is it giving you the desired output? I am not sure if you have already had a solution or are still looking for help. Please let me know if you need help 
Hey,
Sorry I missed the solution button. It is working as expected. Thanks
1 Like