0

I want to build a flow that enables me to mass create a list of folders. It's easy enough to create a list of single folders (initialize variable to an array, loop through the array and create a folder per item) but I'm having trouble creating a list of sub-folders within each of those folders.

Maybe I'm thinking about this too in-the-box but in JavaScript I would create a nested for loop, blah blah, blah.

Any ideas?

1 Answer 1

0

I assume you are using the "Create folder" action? In this you define the "Folder path", so in your loop you start by creating the top most folder, then create the next level and so on and so on. For each sub folder you create you take the folder path from the parent that was created before and put in.

You are welcome to post your source object of the folder hierarchy that you need to create and I can take a look at that if that is causing the impediment.

enter image description here

4
  • Hi - Yes, I'm using the Create folder function on each of the items in the array of folder names BUT the caveat is that each of these items also needs to have the same 6 folders created within each. This works for the original array: Flow sequence. In a hacky fashion, I ran 6 create folder action per item but there has to be a more elegant way... I don't know if there is a way to then loop through the newly created folders to add in the additional 6 sub-folders per? Even better would be to do it all in one swoop :)
    – pmath325
    Dec 7, 2021 at 17:56
  • Aha ok, makes sense. You can nest a loop so that for each top folder you create, you also loop through the standard list of sub folders that will be created. In the innner loop you already know that. For me that is elegant enough :) Look at screen dump here: imgur.com/a/GSroygJ As batching the folders to be created I do not think this is possible with Power Automate/rest API. But you can create several folders if they are nested. Eg. defining a deep path will create all the folders that doesnt exists already.
    – RuneBH
    Dec 7, 2021 at 18:32
  • That worked perfectly - thank you!
    – pmath325
    Dec 7, 2021 at 18:50
  • Awesome! I am happy :)
    – RuneBH
    Dec 7, 2021 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.