cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Shagoul
Helper III
Helper III

count the number of files on LOCAL Drive

Hi All,

 

I’ve applied the delay option based on the number of excel files in the LOCAL Drive(example D:).

 

Can someone help how to count the number of files on LOCAL Drive? (NOT Onedrive or Sharepoint folder)

 

If I’ve 2 files then I’ve to apply a delay of 5 minutes if I’ve more than 2 files then I’ve to apply 10 minutes in the flow.

 

Thanks & Regards,

Shagoul

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi @Shagoul,

Do you want to count the number of files existing in a folder in file system?

Could you please share a bit more about your scnenario?

 

Actually, I think the List files in folder from File System connector could achieve your need.

vqiaqimsft_0-1656486495702.png

vqiaqimsft_1-1656486504770.png

Here is how I configure the flow:

vqiaqimsft_2-1656486560522.png

 

If, I mean in case of a situation that the compose returns a number that is 1 greater than the indeed total number, please troubleshoot as below.

1). It seems to be a wrong number, however it may be a hidden file Thumbs.db, which is a database file containing a small JPEG representing each of the thumbnails in a folder. 

2). You could open the body and search for thumbs.db, if it exists, well that's why it returns a wrong total number

vqiaqimsft_3-1656486889600.png

vqiaqimsft_4-1656486896743.png

3). You need to minus 1 for the compose returned number if you want to delay based on the total number.

 

Best Regards,
Qi

View solution in original post

4 REPLIES 4
v-qiaqi-msft
Community Support
Community Support

Hi @Shagoul,

Do you want to count the number of files existing in a folder in file system?

Could you please share a bit more about your scnenario?

 

Actually, I think the List files in folder from File System connector could achieve your need.

vqiaqimsft_0-1656486495702.png

vqiaqimsft_1-1656486504770.png

Here is how I configure the flow:

vqiaqimsft_2-1656486560522.png

 

If, I mean in case of a situation that the compose returns a number that is 1 greater than the indeed total number, please troubleshoot as below.

1). It seems to be a wrong number, however it may be a hidden file Thumbs.db, which is a database file containing a small JPEG representing each of the thumbnails in a folder. 

2). You could open the body and search for thumbs.db, if it exists, well that's why it returns a wrong total number

vqiaqimsft_3-1656486889600.png

vqiaqimsft_4-1656486896743.png

3). You need to minus 1 for the compose returned number if you want to delay based on the total number.

 

Best Regards,
Qi

Hi @v-qiaqi-msft 

 

Thank you for the response 😊

 

Exactly you’re right about what I am expecting but am not familiar with gateway when using the file system.

 

Can you share is there any other way to count the files from the rot folders.

Hi @Shagoul

Based on your issue and where you post it, I think the file system connector is the best method. Gateway setting is the way how you could access to the local drive.

 

If you want to solve this based on the windows system, I don't think Power Automate is a good place for you.

 

Here is an alternative solution, Power Shell or running cmd.

1). Power Shell:

run the command cd [path], where [path] is your folder's path.

If you want to count the files and subfolders found in our Documents folder, located in "E:\OneDrive," so we need to run cd "E:\OneDrive\Documents". If you want to count only the files in the folder, run this command: (Get-ChildItem -File | Measure-Object).Count.

vqiaqimsft_0-1656554966440.png

2). cmd:

dir /a:-d /s /b "Folder Path" | find /c ":"

If you want to count the files in "E:\OneDrive\Documents" folder, so we had to run 

dir /a:-d /s /b "E:\OneDrive\Documents" | find /c ":"

 

Best Regards,
Qi
Shagoul
Helper III
Helper III

Thank you so much for the alternative  solution as well 🙂

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (3,829)