2

I'm wanting to create a flow where if a user creates a folder at the root of a document library, a set of sub folders and files populate that newly created folder. So for example a user goes and creates a new folder called "Ryan", then the flow would create a pre-defined set of sub folders into that folder.

I can get the flow to create the folders fine, however it also creates the folders within the root of the document library as well which I don't want.

For example, "Ryan" was the newly created folder and "test1" was the subfolder to go inside it. It creates test1 in Ryan however creates "test1" at the document root as well with another "test1" folder inside that. This is the only flow I have so there is no other flow creating/interfering.

enter image description here

If someone could advise how to get it to stop creating the folders in the root after creating them inside the newly created folder, it would be appreciated.

2
  • This is happening because your flow is running multiple times after creating the subfolder using power automate. Commented May 25, 2021 at 17:22
  • Thank you for this, I can now get it to create the folder without creating it in the root. One last question I have is how I get this for multiple folders/files to be created. When I try add another "create new folder" below it to put "test2" for example in, the same problem occurs. Do I need to add another condition somewhere for each new folder?
    – Ewan
    Commented May 26, 2021 at 12:30

2 Answers 2

0

This is happening because your flow is running multiple times after creating the subfolder using power automate.

To avoid creating the folders again at root level, configure your flow like this:

enter image description here

I have added 2nd condition in the If yes of first condition.

For 2nd condition:

  1. Left side --> Select Folder path from When an item is created trigger like:

enter image description here

  1. Right side --> Type the name of your document library followed by / (Example: test/)

Inside If yes of 2nd condition, add (drag & drop) your Create new folder action (as shown in first image).


This flow will only create the subfolder when you add new folder at the root of a document library.

0

Please following steps:

1.Add new column named "Tag" in the Documents Library

enter image description here

2.Create new MS Flow

a.Add "When an item or a file is modified" trigger

b.Add "Condiition" action:

  • IsFolder is equal to true
  • Tag is equal to root

c.On the "If yes" branch, add "Create new folder" action:

  • Folder Path: Name/Test1

enter image description here

3.Test and Save this Flow

4.When you create a root folder in the Documents library and edit the folder (type "root" to the Tag column), the following situation will appear:

enter image description here

Your Answer

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

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