Skip to main content

Notifications

Community site session details

Community site session details

Session Id : /hfTGJ6V/lB2MGEexW80Nw
Power Automate - Building Flows
Suggested answer

Create a subfolder inside of a newly manually created folder.

Like (0) ShareShare
ReportReport
Posted on 14 Feb 2025 17:33:18 by 12
I cannot for the life of me figure out what I think should be easy. 

Here is the goal: In my SharePoint Document Library I have a list of folders: 
Inside of "Construction Projects" someone will manually create a folder. In this instance we will use "Test Folder":
 
When this happens, a flow in PA, should trigger and create a subfolder called "Estimates" inside of "Test Folder": The flow I have created is below: 

 I added "Documents" manually in List Name because it does not give me an option to choose library. I previously tried this same flow with the trigger "When a file is created (properties only)" but it gave me the same result. 


However, when I create "Test Folder" in the "Construction Project" folder, it does not create a subfolder in that specific directory. Instead it creates a folder called "Shared Documents" in the root directory which has "Construction Projects>Test Folder>Estimates". I don't know why it is creating this folder structure in the root directory and not where I have specifically mapped it to go. 

In the "Check if its going to the correct folder path" condition, I tried changing "Shared Documents" to "Documents" but it always returns false. I have also tried just doing "/Construction Projects" but that will just create a new folder in the root directory called "Construction Projects". 

Im at a loss. Any help on this would be greatly appreciated. 
 
  • Nived_Nambiar Profile Picture
    17,554 Super User 2025 Season 1 on 06 Mar 2025 at 02:45:37
    Create a subfolder inside of a newly manually created folder.
    Hi,
     
    In you create file action try the following modifications as shown below in folder path:
     
     
     
     
     
    Expression: 
    substring(outputs('Create_new_folder')?['body/{Path}'],0,sub(length(outputs('Create_new_folder')?['body/{Path}']),1))
     
     

    Thanks & Regards,
    Nived N

    Stay connected:
    LinkedIn | YouTube | Blogs

    Was this answer helpful?
    If yes, please mark it as the solution by selecting the checkbox in the discussion thread.
    Your feedback motivates me to keep contributing. Thank you!

     
     
     
  • CalleyMinuz Profile Picture
    12 on 03 Mar 2025 at 20:09:28
    Create a subfolder inside of a newly manually created folder.
    In your example, you are putting data.txt inside of the Estimates folder. That is not what I am trying to do. The data.txt folder should go in the manually created folder. The manually created folder should have :
    1. Estimates folder (nothing inside of it)
    2. data.txt

     
  • Suggested answer
    Nived_Nambiar Profile Picture
    17,554 Super User 2025 Season 1 on 03 Mar 2025 at 18:21:39
    Create a subfolder inside of a newly manually created folder.
    Hi ,
     
    I tried something simmilar to create .txt files under the folder.
     
     
     
     
    It worked for me 
     
    Also if you want to limit trigger creation around construction folder - you can limit in trigger as shown below
     
     

    Thanks & Regards,
    Nived N

    Stay connected:
    LinkedIn | YouTube | Blogs

    Was this answer helpful?
    If yes, please mark it as the solution by selecting the checkbox in the discussion thread.
    Your feedback motivates me to keep contributing. Thank you!

  • CalleyMinuz Profile Picture
    12 on 03 Mar 2025 at 17:27:24
    Create a subfolder inside of a newly manually created folder.
    It created over 50 folders and spreadsheets before I stopped it in under 30 seconds with making the edit you suggested.
  • CalleyMinuz Profile Picture
    12 on 03 Mar 2025 at 17:25:41
    Create a subfolder inside of a newly manually created folder.
    I think you misunderstood as this does not work. When I setup what you suggested it does the following: 



    The "test Job Schedule.xlsx" is correct. But it goes on a never ending loop and keeps creating folders and spreadsheets: 



    It keeps creating folders and renames the folders and spreadsheets. It keeps going and the slows the entire site up and the only way to stop it is to delete the original folder. So adding "Folder Path" and then "Name" does not work, it in fact breaks everything. 
     
     
  • Suggested answer
    Nived_Nambiar Profile Picture
    17,554 Super User 2025 Season 1 on 03 Mar 2025 at 17:08:58
    Create a subfolder inside of a newly manually created folder.
    Hi
     
    While creating file/spreadsheet in destination folder- make sure use the following dynamic content from Create folder action (which has been used to create the Estimates folder)
     
     
     

    Thanks & Regards,
    Nived N

    Stay connected:
    LinkedIn | YouTube | Blogs

    Was this answer helpful?
    If yes, please mark it as the solution by selecting the checkbox in the discussion thread.
    Your feedback motivates me to keep contributing. Thank you!

  • CalleyMinuz Profile Picture
    12 on 03 Mar 2025 at 16:23:11
    Create a subfolder inside of a newly manually created folder.
    I am trying to add an additional function and create a spreadsheet dynamically the same way I am creating the folder dynamically with the name. But I am having a similar issue. Here is my current flow: 

     
     


    The folder path I simply copied from the solution you gave me and put it on the create job schedule spreadsheet function, but it does not create it. It errors out and says it cant find the root folder. When I tried adding the dynamic content "Full Path" it creates the spreadsheet in the proper place but it also creates it in every single folder created in the Root folder which is not correct and im not sure why it would do that. 
     
  • Nived_Nambiar Profile Picture
    17,554 Super User 2025 Season 1 on 15 Feb 2025 at 10:54:39
    Create a subfolder inside of a newly manually created folder.
    Hi,
     
    There is small correction to be added in the Create folder action as shown below
     
    Expression: replace(triggerOutputs()?['body/{FullPath}'],'Shared Documents/','')
     
    Removing Shared Documents sentence from folder path helps to create the folder in desired path. 
     
     

    Thanks & Regards,
    Nived N

    Stay connected:
    LinkedIn | YouTube | Blogs

    Was this answer helpful?
    If yes, please mark it as the solution by selecting the checkbox in the discussion thread.
    Your feedback motivates me to keep contributing. Thank you!

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
stampcoin Profile Picture

stampcoin 87

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 70 Super User 2025 Season 1

#3
David_MA Profile Picture

David_MA 48 Super User 2025 Season 1

Overall leaderboard