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 / Help build flow to cou...
Power Automate
Answered

Help build flow to count amount file in each subfolder on onedrive cloud

(0) ShareShare
ReportReport
Posted on by 7
I have a folder tree structure on OneDrive cloud.
I want to build a flow on Power Automate and connect to my onedrive and count the number of files (images) in each subfolder and export the results to a csv file.
Hopefully someone can help me do it, if possible, provide me with an available flow template. Thanks!
I am beginer about Power Automate 😂
Categories:
I have the same question (0)
  • Verified answer
    Rhiassuring Profile Picture
    8,692 Moderator on at

    Hi there, 

     

    Try this out:

     

    Step 1) Manually trigger a flow. (Or schedule it, whatever you need.)

     

    Step 2) "Send an HTTP Request to SharePoint". (The fact that you're using OneDrive is fine. Go to your OneDrive, and note the full URL for the Site Address. You will need to copy / paste it in, as you see I did here. Use 'Documents' like I did for the URI.) 

     

    Step 3) Use a "Select". In the "From", click, then use the expression tab / fx and paste in this:

     

    body('Send_an_HTTP_request_to_SharePoint')?['d']?['results']
     
    Step 4) In the "Map" area, type in Name and Item Count, and opposite of them, again you'll enter an expression for each:  
    item()['Name']  and  item()['itemcount']
     
    Rhiassuring_2-1701923506485.png

     

    When it's run at this point, our output looks like this:
     
    Rhiassuring_0-1701923172866.png
     
    Now you have an array that you can do anything you want with. If your output desire is a CSV, you can put that output into a "Create CSV Table", and then use the output from THAT in the "File Content" field inside of a "Create File" action for OneDrive.  Just make sure the File Name is something like FileCount.csv -- and if you don't want the file renamed every time, you'll need a variable (date, time, something like that) in the file name.
  • ngoclq Profile Picture
    7 on at

    Thank you so much! 

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!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 60 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 54

#3
Expiscornovus Profile Picture

Expiscornovus 47 Most Valuable Professional

Last 30 days Overall leaderboard