cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
darknight123
Helper I
Helper I

Auto populate a subfolder with subfolders

I am trying to create a flow where if a subfolder is created in a parent folder, automatically populate that subfolder with 5 pre made subfolders. Ex: named (1,2,3,4,5). 

 

Parent Folder>SubFolder<Auto populate that subfolder with 5 additional subfolders named (1,2,3,4,5). 

 

Tried to do it myself but the create folder at the end of my flow is having trouble finding the subfolder in the parent to create the subfolders. 

 

Thanks everyone in advance. | Not needed* but if the subfolders can be uploaded in order to my liking that would be cool. 3 is first then 5 etc. I wont be using numbers for my real folders. 

1 ACCEPTED SOLUTION

Accepted Solutions

A solution might be to look at the Full Path and count how many text strings there are in the full path - this should tell us if the folder was created under a Parent folder.

 

For example, if a folder was created at the right level , we can split the Full Path "Lib1/Parent1/Sub1" at the '/' character. We will get three strings Lib1, Parent1, Sub1- and this means that the new folder was created under a Parent Folder at the correct level.


Example: Lib1 =Document Library, Parent1 = Parent Folder, Sub1= sub folder name
Full Path = "Lib1/Parent1/Sub1" 

 

So try something like the following:

Add: ComposeSplitPath action

Update: Condition Is root Folder

Update: Create new folder path

 

ekarim2020_0-1642553695875.png

 

split(triggerOutputs()?['body/{FullPath}'],'/')

 

ekarim2020_1-1642553724558.png

Snag_1804e4c2.png

 

Snag_180615ef.png

 

 

Ellis

 

View solution in original post

10 REPLIES 10
ekarim2020
Super User
Super User

Please see if the following post is of any assistance:

If SharePoint Folder create than create subfolder in the created folder 

 


Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

Thanks. This is close but I would like when I create a subfolder (2nd level) 5 subfolders automatically become in the subfolder. This one is for the parent folder or (1st level). 

Try modifying the Create new folder action (in If SharePoint Folder create than create subfolder in the created folder ) :

 

Snag_17c5c7d6.png

Or do you mean:

 

Document Library = Lib3

Parent Folder = Top3

If a new folder was created under Top 3, auto-create a number of subfolders under Top3?

Lib3\Top3\new-folder\new subfolders?

 

Ellis

 

 

 

Ellis

 

Thanks for the response. It appears your screenshot is the original screenshot for the parent/ (1st level).  I want to trigger this when a subfolder is created and route the additional 5 subfolders to the new subfolder. Parent>SubFolder<auto create 5 subfolders and route them to Subfolder. Possibly the compose function needs to change too because its path is the Parent to sub instead of sub to sub.

A solution might be to look at the Full Path and count how many text strings there are in the full path - this should tell us if the folder was created under a Parent folder.

 

For example, if a folder was created at the right level , we can split the Full Path "Lib1/Parent1/Sub1" at the '/' character. We will get three strings Lib1, Parent1, Sub1- and this means that the new folder was created under a Parent Folder at the correct level.


Example: Lib1 =Document Library, Parent1 = Parent Folder, Sub1= sub folder name
Full Path = "Lib1/Parent1/Sub1" 

 

So try something like the following:

Add: ComposeSplitPath action

Update: Condition Is root Folder

Update: Create new folder path

 

ekarim2020_0-1642553695875.png

 

split(triggerOutputs()?['body/{FullPath}'],'/')

 

ekarim2020_1-1642553724558.png

Snag_1804e4c2.png

 

Snag_180615ef.png

 

 

Ellis

 

Good Morning Ellis,

The flow was green until create folder then it gave an error. Some additional information: The root condition folder triggers on the 47th. My folder path in create folder is 

outputs('ComposeSplitPath')?[1] / outputs('ComposeSplitPath')?[2] / items('Apply_to_each'). 
 
Screenshot (10)_LI.jpg
Screenshot (9).png
Unable to process template language expressions in action 'Create_new_folder' inputs at line '0' and column '0': 'The template language expression 'outputs('ComposeSplitPath')?[1]' cannot be evaluated because property '1' cannot be selected. Property selection is not supported on values of type 'String'. Please see (had to remove a link) for usage details.'. (The error create folder gives)
 
Thank you for everything you have done so far! We are almost at the finish line!

HOLY COW! IT WORKS! I was reading on my end and they say that error is when something is changed in the flow and it just bugs it out so just make a new flow of it. Tested it twice and it works! DUDE THANK YOU SO MUCH, you dont understand how hard of a time this was giving me. Mad props! 

I know this is an old post but I am trying to accomplish the same thing. What are the inputs under the "compose info" and "compose subfolderpath" operations? 

 

subfolder_flow.png

I still seem to have a version of that flow, looks like I didn't delete it. It may not be exactly the same version, but here it is:

 

Snag_b1711c2.png

Snag_b17468d.png

ekarim2020_1-1649266299262.png

Snag_b1b2e20.png

 Ellis

 

 

 

This is perfect. Thank you so much!!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (1,684)