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 / Count number of files ...
Power Automate
Answered

Count number of files in OneDrive folder

(0) ShareShare
ReportReport
Posted on by

Hello Everyone,

 

i have a OneDrive folder with X amount of files in it (less then 100). Every X hours i want to compose them all into one file and have a new file that includes how many files there have been.

 

20221212_fileA

20221212_fileB

20221212_fileC

20221212_fileD

-> Composed to 20221212_filesComposed_4files

 

The flow starts with a "get files" and so i thought i could just use this solution presented here:

https://powerusers.microsoft.com/t5/Building-Flows/count-files-folder-onedrive/m-p/275945#M28379

 

It does however not work so i am looking for help from you all if possible.

 

Kind regards

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @Kastore,

     

    Like in that link you can use a length function in an expression to get a file count.

     

    Below is an example

    The expression is used in the File Content of a new text file.

     

     

    string(length(outputs('List_files_in_folder')?['body/value']))

     

     

    expression_length.png

  • Community Power Platform Member Profile Picture
    on at

    Hello @Expiscornovus 

     

    that works like a charm.

     

    Only point is that there is also a folder in that directory which is also included in the count. Is there a way to skip the folder or just substract one from the "length" expression?

  • Verified answer
    Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @Kastore,

     

    You can filter on the IsFolder property and make sure it is false. This way if in the future you add even more folders to it, it will still work 😉

     

    The length expression will be a bit different because it counts the outputs of the Filter Array action instead:

    string(length(body('Filter_Array')))

     

    filterarray_isfolderfalse.png

  • Community Power Platform Member Profile Picture
    on at

    Cheers mate.

     

    that is basically the same solution as in the link that I saw but reduced down to what matters. The link with the variables always made troubles - the direct route via "filter array" works like a charm and filters out the folder.

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 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard