web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How can I delete file ...
Power Automate
Answered

How can I delete file from SharePoint library based on date column?

(0) ShareShare
ReportReport
Posted on by 42

Hello,

 

I tried to create a flow which will delete the files in case of "Deletion" column's (date column) is less than today's date. I couldn't get it to work. I tried several ways, such as filtering if Deletion column is not empty but no success. Capture.JPG

 

How can I create a working flow?

Categories:
  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    The key here is what you use as a trigger. For this kind of Flow you'll need a recurrence trigger that runs on a schedule, maybe once a week.  Then when it runs get all the documents in the library and process them with a ForEach loop.  in the loop do your comparison and delete the document if the deletion date is less than today.

  • Purman2 Profile Picture
    9 on at

    Thank you for you answer. I use the once per week trigger. What should I modify to get it work? 

     

    (Sorry, it's my secondary user) @Purman 

  • ScottShearer Profile Picture
    25,331 Most Valuable Professional on at

    @Purman 

    If you want to delete files with a date in the "Deletion" column less than or equal to today, try something similar to the following screen shot.

    Please note:

    • There are single quotes around my expression in the filter query
    • I am assuming that you are using a recurrence trigger
    • In my expression I used le for less than or equal to.  You may want to use lt for less than instead

     

    DeleteFile.jpgDeleteFile1.jpg

  • Purman Profile Picture
    42 on at

    @ScottShearer 

     

    Thank you for your answer! I had this error message:

     

    "message": "The expression \"Deletion le 1 ' 2019-07-31'\" is not valid. 
     
    What should I modify?
  • Verified answer
    ScottShearer Profile Picture
    25,331 Most Valuable Professional on at

    @Purman 

    My mistake.....

    Remove the 1 after le in the filter and you should be OK:

    DeleteFile2.jpg

  • Purman2 Profile Picture
    9 on at

    @ScottShearer 

     

    Fantastic! Thank you, it's working!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 298 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 289

#3
Henil Profile Picture

Henil 125

Last 30 days Overall leaderboard