cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MathiasJ
New Member

Exclude subfolder in "find file in folder"

Hi!

I have a flow, which I want to schedule every 20th each month.

This flow should check if there are any files in a specific folder on my OneDrive, BUT exclude subfolders and files in there.

If there are any files in that exact folder, attach those files in an email and send. 

My issue is that I cant figure out how to ignore the subfolder.

 

Any ideas?

7 REPLIES 7
v-bacao-msft
Community Support
Community Support

Hi @MathiasJ ,

 

You could use Is folder? to exclude subfolders and files inside it in the specified folder.

 

Image reference:

12.PNG

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Unfortunately, the search is still looping through the files in that subfolder. I am only interested in files in the parent folder

Hi @MathiasJ ,

 

Below is my test result. In Apply to each, only the files and subfolders in the specified folder are traversed, the files in the subfolders are not included.

And I used Condition to exclude the subfolders, so I can only get the file contents of the files in the specified folder.

 

Flow configuration:

28.PNG

The specified folder in OneDrive:

29.PNG

Flow run history:

30.PNG

Only traversed 7 items, excluding subfolders, and only getting the contents of the file when Condition is true.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @MathiasJ ,

 

Any update?

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

It didn't quite work for me, but I managed to validate on the file path that If [file path] contains [subfolder name], it will skip that file.

Hi Barry, I know this is an old post but just wanted to say this worked perfectly for me when I had the same issue today, so many thanks 👍

 

cheers

 

Richard

RyanRhode
New Member

Hello - I am trying to achieve the same using Power Bi - anyone have helpful tactics to ommit certain subfolders?
Current function is simply ' Source = Folder.Files("file location")

 

I am trying to ommit specific sub folders within those parent files.

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,573)