Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

Deleting Attachment prior to saving new



I have few basic flows that save my email attachments into sharepoint folders for Power BI to generate reports. However I still have to delete old file manually. The problem is each folder contains previous years data which I want to keep and only delete this years data (updated daily). I have put DO NOT DELETE in the previous years files name, so the flow knows not to delete anything with that phrase. Ideal scenario would be that when email comes in it triggers deletion of any file does not contain DO NOT DELETE in the file name and then save new attachment that just came through. Can this be done?

Power Participant
Power Participant

Super User
Super User

This should delete all files without DO NOT DELETE in the name


In Get files you can use the filter query

FSObjType eq 0

to ignore folders



File identifier is items('Apply_to_each')?['{Identifier}'] 


Let me know if that works for you.





Helpful resources

Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,554)