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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / folderPath Condition w...
Power Automate
Unanswered

folderPath Condition with variable

(0) ShareShare
ReportReport
Posted on by 12

I'm trying to create a flow with When a file is created (properties only) trigger but I only want it work in specific folders.

In a folder structure that looks like Folder 1 -> Folder 2 -> Folder 3 -> Folder 4 I only want to tigger a flow when a file is created in Folder 2 and Folder 3. I've managed to create a flow that achieved that but I as you can see on the image below I had to indicate a specific folders in which creating a file triggers a flow.

 

Zrzut ekranu 2021-03-8 o 13.36.42.png

 

What I would like is to find a way to make a condition look like this:

 

folderPath is equal to Shared Documents/x/

or

folderPath is equal to Shared Documents/x/y/

 

where "x" is folder of any name in a Shared Documents and "y" is folder of any name in a "x" folder

 

I'd be grateful for your help 🙂

Categories:
I have the same question (0)
  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @PrzemekKP  do you want to check if file is created in first level or second level of folder under Shared Documents?

  • PrzemekKP Profile Picture
    12 on at

    @annajhaveri Hi! What I want is to trigger the flow when a file is created in the second and third level under Shared Documents but not when a file is created in first, fourth, fifth and next levels.

     

    Regards,

    Przemek

  • Verified answer
    annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @PrzemekKP  you can add Compose action to your flow as shown in below screenshot

     

    annajhaveri_0-1615391377982.png

     

    configure below expression in the compose action

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

     

    This expression will give you length of number of '/' in the folder path i.e. level of folders in folder path, so if the folder path is Shared Documents/x/ the length returned by expression will be 3 and if folder path is Shared Documents/x/y/, ,then length will be 4

     

    So first add the compose action and then add condition to check if output of compose action is 3 or 4 as shown in screen shot below

     
     

    Screenshot 2021-03-10 212511.png

     

     

  • PrzemekKP Profile Picture
    12 on at

    Hi! Thank you very much! It is exactly what I needed.

     

    Regadrs,

    Przemek

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard