cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Momo
Frequent Visitor

Condition: Folder in sharepoint is empty

Hi all,

 

I'm currently making a flow, which will delete all items on a library if their modification date is older than 10 years. However I'm struggling with finding a condition, which states that the folder has to be empty in order to be deleted. Any Ideas?

Capture.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
SCTdan
Continued Contributor
Continued Contributor

You can use List Folder to get folder contents, or Get Files should work too.  Since that returns an array of items, you can use the length() function to determine if there are any files.

 

Quick example-

 

With no files in the folder-

 

And with one file in the folder, returns False-

 

 

Hopefully that does what you need it to!

View solution in original post

3 REPLIES 3
SCTdan
Continued Contributor
Continued Contributor

You can use List Folder to get folder contents, or Get Files should work too.  Since that returns an array of items, you can use the length() function to determine if there are any files.

 

Quick example-

 

With no files in the folder-

 

And with one file in the folder, returns False-

 

 

Hopefully that does what you need it to!

View solution in original post

v-bacao-msft
Community Support
Community Support

Hi @Momo,

 

I think the way SCTdan provides is work for you. Please try it.

In addition, you could also use Get files to get the items first, and then determine whether it is a folder. If so, configure the Id in the List folder action.

Please take a try.

 

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.
Momo
Frequent Visitor

It works and I learned something new. thank you very much!

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (87,634)