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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to get a flat list...
Power Automate
Unanswered

How to get a flat listing of all files with path for all subfolders in onedrive

(0) ShareShare
ReportReport
Posted on by
I am looking to list all of the files in a well organised folder structure in onedrive. 
 
The end result is to use the folder names as metadata for the files in a flat sharepoint document library.
 
I can across this thread, and obadiahjohnson has posted the answer I am looking for but some of the linked pictures are broken.
 
 
I am struggling to figure out the condition inside the apply to each and I think that is what is shown in the missing picture.  There must be a list files in folder action in there somewhere.  
 
Thanks very much for any help or pointers!
Categories:
I have the same question (0)
  • Chriddle Profile Picture
    8,691 Super User 2026 Season 1 on at
    That's how I would do it.
     
     
    Initialize 3 variables
    To get the id of your initial folder, add an action "List files in folder", select the folder and open the actions "Peek code". Copy the value of the object's input/parameters/id
     
     
    Do until
    Do until Index is greater or equals length of FolderProps
    Change the count limit to an appropriate value.
     
    List files in folder
    variables('FolderProps')[variables('Index')]['Id']
     
    Filter array Files
    Filter for files (isFolder is false)
     
    Compose NewFileProps
    union(variables('FileProps'), body('Filter_array_Files'))
     
    Set variable 2
    Set variable FileProps to Compose_NewFileProps
     
     
    Do the same with FolderProps
     
     
    Last action in the loop:
    Increment Index
    It might be a good idea to check all boxes in its Run after configuration
     
     
    After the loop is ready, the FileProps variable contains the file properties of all files in all folders including subfolders.
     
     
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 957

#2
Valantis Profile Picture

Valantis 847

#3
Haque Profile Picture

Haque 609

Last 30 days Overall leaderboard