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 / 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,436 Super User 2025 Season 2 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

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