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 / Automatically delete f...
Power Automate
Unanswered

Automatically delete files (if not used) in Document Library folders 3 months

(0) ShareShare
ReportReport
Posted on by 2

Hi everyone,

 

So What I want to achieve is to create a flow that automatically deletes everything in certain folders on Document Library, only if nobody touched those folders for 3 months. (meaning, if nobody uses files in certain folders for 3 montsh, I want them to be automatically removed from Sharepoint Document Library).

 

Help would be much appreciated!

 

Thank you!

Categories:
  • Sundeep_Malik Profile Picture
    6,501 on at

    Hey @Giga 

     

    You can use the Action get files(properties only).

    After this use Apply to each and pass value field that you got from above.

    After this use Modified field in a condition and put it less than than the date utcNow-90 days.

    And if yes, just use action delete file.

    Condition add days formula: addDays(utcNow(),-90)

     

    Sundeep_Malik_0-1663294990020.png

    I hope this helps.

  • Giga Profile Picture
    2 on at

    Hi @Sundeep_Malik ,

    Thank you very much for your response. 

     

    I started building the workflow based on your suggestion, but in a "Delete file/File Identifier" field, it asks me to specify a file that will be deleted. This is not what I want, what I want is to delete everything in the folder/directory that I have specified, if the uploaded content won't be used for more than 3 months.


    select a file.png

     

    Best regards,

    Giga

  • Sundeep_Malik Profile Picture
    6,501 on at

    Hey @Giga

     

    So, I have come up with another technique for you. But you can only delete all the files from the folder, not the folder because there is no option to delete a folder.

     

    First use list folder. After this use action get folder metadata and add the id you are getting from above. This will automatically create an apply to each loop. Then use a compose statement to store the modified on field.

     

    Sundeep_Malik_0-1663517489314.png

     

     

    After this use condition and add outputs of above compose and check if its less than the currentdate-90. If yes, use get files(properties only) and after that use delete file option.

     

    Sundeep_Malik_0-1663517692670.png

    But But But, read my next comment before using this.

  • Sundeep_Malik Profile Picture
    6,501 on at

    So, I added a new file to a folder. But, its modified on date didnt change. I delete as well as modified the files inside it. But the date didnt change for the folder. Only the date changed for the folder, if I renamed the folder. So, I dont think your problem will be able to solve in power automate.

     

    Instead you can try my 1st technique only to delete all the files which were not modified in the last 90 days. And in the identifier just pass the ID field you are getting from get files(properties only).

     

    You can try yourself the folder thing.

     

    I hope this helps.

  • Rodrigo Hentz Profile Picture
    Microsoft Employee on at

    HI @Giga how are you? 

     

    @Giga the suggested process for @Sundeep_Malik helped on your scenario?

     

    If so, please, mark the post as answered or if you need more help on it please let us know 🙂

     

    Best regards

     

    Rodrigo Hentz

    Microsoft Power Platform Support Engineer

     

     

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 273 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 235

#3
David_MA Profile Picture

David_MA 172 Super User 2026 Season 2

Last 30 days Overall leaderboard