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 / Delete SharePoint file...
Power Automate
Answered

Delete SharePoint files after X days failure

(0) ShareShare
ReportReport
Posted on by 8

Hi,

 

I have created a flow that looks through certain folders on SharePoint to delete files that are older than 30 days. I've repeated the steps 4 times because I have 4 folders to look through. 

 

Two of those run successful, and two show failure. This is the failure message:

KnucklezZ_0-1652274983385.png

 

It's the same "does not exist" error every time but for different files. 

 

The flow is pretty straight forward:

KnucklezZ_1-1652275195512.pngKnucklezZ_2-1652275243776.png

 

I have these repeated with just the Folder being different.  The filter query is: 

addDays(utcNow(), -30)
 
Any ideas how to fix this?
 
Thank you,
 
Mateusz
Categories:
I have the same question (0)
  • Argy_Zadkine Profile Picture
    51 on at

    Thanks Bof, I was having the same issue , and now used your suggestion and it works fantastic!

     

    Argy

  • KnucklezZ Profile Picture
    8 on at

    @v-bofeng-msft 

     

    Hey,

     

    Thank you so much for your help. The flow is now successful. I will keep an eye on if it's actually deleting files after the 30 days in all folders. but for now I would say it's case closed. 

     

    Thanks again!

  • v-bofeng-msft Profile Picture
    on at

    Hi @KnucklezZ ,

     

    vbofengmsft_0-1652952890899.png

    The argument in items() needs to correspond to the name of the current loop, if the current loop is 'Apply to each 2' then it should be items('Apply_to _each_2') or items('Apply_to _each2')

     

    Best Regards,

    Bof

  • KnucklezZ Profile Picture
    8 on at

    Hey @v-bofeng-msft 

     

    I actually noticed that after I sent the post, haha, thanks.

     

    I am getting an error when I do the steps for the 2nd folder (1st seems fine):

    KnucklezZ_0-1652952637154.png

     

  • v-bofeng-msft Profile Picture
    on at

    Hi @KnucklezZ ,

     

    you need to set the filter array's condition to 'is equal to false'

     

    vbofengmsft_0-1652951875797.png

     

    Best Regards,

    Bof

     

  • KnucklezZ Profile Picture
    8 on at

    Hey @v-bofeng-msft 

     

    Should this work?

     

    KnucklezZ_0-1652949169495.pngKnucklezZ_1-1652949842110.png

    KnucklezZ_3-1652949924710.png

     

     

     

  • v-bofeng-msft Profile Picture
    on at

    Hi @KnucklezZ ,

     

    Is the problem solved? Do you need any help?

     

    Best Regards,

    Bof

  • v-bofeng-msft Profile Picture
    on at

    Hi @KnucklezZ ï¼Œ

     

    Yes you need to ding it 4 times. Or you could try 'Delete item' instead of 'delete file'.

     

    The key point is that the 'Delete file' action can not delete a folder , so you should add a filter action to filter out the folders.

     

    Best Regards,

    Bof

  • KnucklezZ Profile Picture
    8 on at

    Hi @v-bofeng-msft ,

     

    Thanks for replying.

     

    Just a few questions:

     

    Do I repeat this for all 4 folders, so doing it 4 times? Also, do I keep the filter query I have used in my flow?

     

    Thanks,

     

    Mateusz

  • Verified answer
    v-bofeng-msft Profile Picture
    on at

    Hi @KnucklezZ ,

     

    Please try:

    vbofengmsft_0-1652428759995.jpeg

     

    Best Regards,

    Bof

     

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
David_MA Profile Picture

David_MA 245 Super User 2025 Season 2

#2
Expiscornovus Profile Picture

Expiscornovus 207 Most Valuable Professional

#3
trice602 Profile Picture

trice602 190 Super User 2025 Season 2

Last 30 days Overall leaderboard