web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Automatic Sub folder s...
Power Automate
Suggested Answer

Automatic Sub folder structure when a new folder is created in a document libary

(0) ShareShare
ReportReport
Posted on by 2
Hallo,
i would like to create an automated cloud flow in Power Automate.
When a folder is created in my document library, I want to check if the newly created item is a folder, if so, I want to create 5 subfolders in this newly created folder: Images, External communication, Internal communication, Documents, Supplier claim
I managed to get the flow to create the subfolders in the new folder. However, a short time later, the same 5 folders are created AGAIN on the first level on which I originally triggered the flow with the new folder.
 

 
these folders are correct
 
 
And then the ssame folders are created on the first layer again besides my created folder "Testfolder"
 
Can someone tell what am I doing wrong or what is missing?
 
It seems that the flow is running several times even if it has been triggered once.... (see attached csv)
 
Thanks in advance for any help given =)
 
Categories:
I have the same question (0)
  • Suggested answer
    NsL Coder Profile Picture
    475 Moderator on at
    the immediate problem is recursive behavior of your flow. You will need to do more conditions to avoid...
     
    So for example:
    • Folder Top Folder is created
      • flow will create Subfolder 1 inside Top Folder
      • flow will create Subfolder 2 inside Top Folder
    • Subfolder 1 is created (by flow)
      • flow will create Subfolder 1 insider Subfolder 1
      • flow will create Subfolder 2 insider Subfolder 1
    • Subfolder 2 is created (by flow)
      • flow will create Subfolder 1 insider Subfolder 1 
      • flow will create Subfolder 2 insider Subfolder 2
    so on and so forth, never ending...(well until create folder fail due to folder too deep or path too long.)
     
    I'm going to assume you do not want ANY folder creation result in the 5 subfolders created, so you need to have more conditions to stop this from happening. For example, maybe you only want subfolders to be created when folder created is at a certain folder level. Or maybe you condition that if the folder created is not the 5 named subfolders.
  • ON-25011933-0 Profile Picture
    2 on at
    Hi NsL Coder, thanks for your reply!
     
    Regarding your example:
     
    • Folder Top Folder is created
      • flow will create Subfolder 1 inside Top Folder
      • flow will create Subfolder 2 inside Top Folder
     
    These folders below won't be created by the flow. It's fine so far. In my manually created folder the structure is exactly as expected. (part1)
     
    • Subfolder 1 is created (by flow)
      • flow will create Subfolder 1 insider Subfolder 1
      • flow will create Subfolder 2 insider Subfolder 1
    • Subfolder 2 is created (by flow)
      • flow will create Subfolder 1 insider Subfolder 1 
      • flow will create Subfolder 2 insider Subfolder 2
     
    But the following happens:
     
    On top level:                             On 2nd level:
     
    Subfolder 1 is created
                                                        Subfolder 1-5
    Subfolder 2 is created
                                                        Subfolder 1-5
    Subfolder 3 is created
                                                        Subfolder 1-5
    Subfolder 4 is created
                                                        Subfolder 1-5
    Subfolder 5 is created
                                                       Subfolder 1-5
     
    Inside each folder (Subfolder 1 to 5) is created again. But it stops always on 2nd lvl - no endless loop I guess.
     
    But I couldn't figured out how to get the flow stop directly after part 1.
     
     
    I'm just a very beginner in creating flows with Power automate.
    So my problem is I don't know what kind of conditions or steps are need in addtion to avoid the creation on first level again...
     
     
    If you have an idea, you are very welcomed to let me know.
    =)
     
    Best Regads
    Olli

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 816

#2
Valantis Profile Picture

Valantis 603

#3
Haque Profile Picture

Haque 566

Last 30 days Overall leaderboard