Creating a rule for automated deletion of unused files

Copper Contributor

Hello together,


I was wondering if there is a setting somewhere in OneDrive for Business which allows the user to set a time after which files should be deleted if they haven`t been touched/modified. 

For example if I create a word file to write down some notes or create a draft and I forget about it it will be in my OneDrive forever. I might not want that because after some time I will have hundreds of unused files that I will never use or look at again.

So i was wondering if there is a rule for example that I can apply either to a specific folder or the complete OneDrive that "monitors" the files and deletes the once that have a last modified date older then 90 days. 

At first glance I couldn`t find anything.


Only thing I came up with was a Flow that runs everyday and checks those files for the last modified date and then deletes the once that have a value older then 90 days. It`s not finished yet but I am pretty sure it will work BUT this might not be a appropriate solution for my customers.


Did someone have this issue/request before?

Best regards Pascal  

5 Replies

@adam deltinger Hello Adam, thanks for sending me this link. Unfortunatly this isn`t really what I need. It looks like retention policies are something the admin sets once and then applies to all users. This is not what I want because there might be users that don`t want any of there files delete after sometime because they are all important or whatever. 

Perfect would be either something the user can set himself directly into OneDrive or a specific folder that you set the rentention policy for. For example you configure that the folder named "Temporary files" will apply the retention policy but all the other folder don`t.

I hope this makes the point a little bit more clear. 

@adam deltinger Hello Adam, thanks for this answer. Unfortunatly we currently don`t have the Microsoft Information Protection activated. Is there any way that wouldn`t involve the Microsoft Information Protection?


Thanks in advance.

@adam deltinger If a retention label is applied in OneDrive but the document is moved to Sharepoint, then my understanding is that the label will remain with the document and therefore will be deleted when the retention criteria is fulfilled, even though these rules should only apply to files stored in Onedrive.


Ideally some kind of retention policy that could be applied to a specific file type or Onedrive folder, rather than to everything in every OneDrive.    As it is, scripting\automate are the only solutions I can think of.