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

Community site session details

Session Id : HliNNL73m6YjQOVOWoaOcx
Power Automate - Building Flows
Answered

Get Folder Name from Get Files name

Like (0) ShareShare
ReportReport
Posted on 30 Aug 2022 15:53:02 by 17

I am new to Power Automate, and this is a simple thing I know but need help with,

I am building a flow that gets all files under a Document Library and returns the values in in an HTML Table, 

 

The result is shown like this: 

 

Document Name Review Date Folder Name Folder

01.FM.0215 - Doc1 v0029/08/2023HR/Process /Assc Forms/

 

I want to split the text in the folder name and show only the last subfolder which in the above case should be assc forms 

When I am trying split expression there is no option to split the Folder Full path property

 

please assist 

Appreciate your help and advice, 

  • Oelshamy Profile Picture
    17 on 30 Aug 2022 at 20:59:02
    Re: Get Folder Name from Get Files name

    Worked very well as required , Thank you very much @Expiscornovus 

  • Verified answer
    Expiscornovus Profile Picture
    32,177 Most Valuable Professional on 30 Aug 2022 at 19:49:49
    Re: Get Folder Name from Get Files name

    Hi @Oelshamy,

     

    You can use a skip and a couple of split functions to retrieve this from the {Path} property of the file.

     

    Below is an example of that approach:

     

     

    skip(split(item()?['{Path}'], '/'),sub(length(split(item()?['{Path}'], '/')), 2))[0]

     

     parentfoldername.PNG

     

    Alternatively, you could look into using the parentuniqueid of the item. However, this does require a couple of HTTP requests. I don't know if that is useful in your scenario. Have a look at my blog about this:

    https://www.expiscornovus.com/2022/06/18/retrieve-parent-folder-name-of-item/

     

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2