Skip to main content
Community site session details
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, 

  • Verified answer
    Expiscornovus Profile Picture
    32,205 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/

     

Helpful resources

Quick Links

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Loading complete