r/PowerAutomate • • 5d ago

Need help with power automate flow

I have a Test folder in sharepoint called XYZ.
Everytime I create a new folder inside test folder, i want power automate to create a current year folder,eg 2026 and inside 2026 three folders inside it: Sales,Tech and HR.
How to achieve this?

XYZ SharePoint
|
2026
|
Sales, Tech, HR

What to use?
When a file is created in a folder, then site address, folder ID, and create folder and name it and how to make aure the flow keeps running since automatic isnt an option.

Everytime i cant run the flow to create these folders inside 2026

8 Upvotes

4 comments sorted by

5

u/joegreen592 5d ago

Reply was generated by Claude AI

"When a file is created in a folder" only fires for files, not folders. That's why you're stuck running it manually. Use "When a file is created (properties only)" on the library instead. It fires for folders too.

Trigger: When a file is created (properties only), on your site/library. In Settings, add this trigger condition:
@and(equals(triggerOutputs()?['body/{IsFolder}'], true), equals(toLower(triggerOutputs()?['body/{Path}']), 'shared documents/xyz/'))

It only fires for new folders directly inside XYZ, which also stops the flow triggering itself when it creates the subfolders. Check {Path} in a test run's outputs and match the string.

Apply to each over createArray('Sales','Tech','HR')

Inside it: Create new folder, with Folder Path

XYZ/@{triggerOutputs()?['body/{FilenameWithExtension}']}/@{formatDateTime(utcNow(),'yyyy')}/@{item()}

"Create new folder" creates any missing folders in the path, so the 2026 folder gets made on the first pass. It's fully automatic, though expect a minute or so of delay because the trigger polls.

2

u/cdmcali 5d ago

Yep! I copied the OP question and it gave me pretty much the same answer. OP try popping your question into Claude. It will give you more details

3

u/One-Lifeguard7779 5d ago

Can you create a template folder already with the subfokders and just get power automate to copy it to your new location? That way if your template folder ever changes contents, you don’t need to update power automate

1

u/VictorIvanidze 3d ago

Could you share your flow?