How to bulk delete versions of files in a folder

Anonymous
2025-02-17T09:35:07+00:00

Hi,

One Drive for our Business Std subscription is making many versions of every file we save, and has been doing so for some time. Our 1TB memory is now full and I need to free up space. I have found a way to delete versions of files, but only by doing it one file at a time. We have many thousands of files and I don't have the time to do this for every one.

1st Question: Is there a way to remove all the versions from all files in a particular folder? I.e. to wipe the slate clean to free up the storage used.

2nd Question: how can I prevent this from happening again?

Many thanks,

Richard

Microsoft 365 and Office | OneDrive | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes
Answer accepted by question author
  1. Anonymous
    2025-02-19T09:01:33+00:00

    Dear Richard Coupland,

    Good day! Thank you for posting to Microsoft Community. I am happy to help you.

    Based on your description, I understand your concern. It seems that you have found a way to delete versions, but only one file at a time, which is not feasible for thousands of files. You’d like to know: How to bulk delete versions of files in a folder to free up storage. And how to prevent excessive versioning in the future.

    Answer 1: Unfortunately, you have to do it file-by-file, there is no UI option to delete the old versions of bulk files from OneDrive.

    To delete versions of files in a folder:

    Step 1: Please go to OneDrive > OneDrive settings > More settings > scroll down Under Feature and storage > select Storage Metrics > select documents or choose your desire folder

    Note: you can immediately see which folder consumes the most space. Actually, all your data is in the Documents folder.

    Step 2: By clicking the folder names, you can dive deeper and see subfolders and files. To check the versions, you can click the Version History link on file level:

    Step 3: By clicking the Delete All Versions link you can get rid of the old versions:

    Answer 2: Preventing Excessive Versioning: To prevent excessive versioning in the future, you can Firstly, install SharePoint Online Management Shell, open it as administrator.

    • Enter connect-sposervice and then enter the url of your SharePoint Admin Center. When a box pops up, enter your Microsoft 365 admin account and password.
    • Run the command Set-SPOTenant -EnableMinimumVersionRequirement $False

    Note: you may need to wait for about 5 minutes for it to take effect.

    After that, when you go to OneDrive > Click the settings Gear on the top right corner > choose OneDrive settings > Return to classic OneDrive > On the tab select LIBRARY > Choose Library Settings > Under general settings choose Versioning Settings > scroll down and find "No versioning" option, select it and click OK.

    Secondly, the Versioning settings link leads to the page where you can disable versioning or limit the number of versions retained.

    Note: however, that turning off versioning here does not delete the existing versions of your files!

    For more details, please follow the thread: Version history fills oneDrive - Microsoft Community

    If you have any further questions or need additional assistance, please don’t hesitate to reach out.

    Have a nice day!

    Best regards,

    2 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2025-02-17T09:49:42+00:00

    Based on the description, my understanding of your issue is with the accumulated versions of several files in the Onedrive/SharePoint.

    I am not sure, if there is a way to delete all file versions for all files in one go.

    But regarding managing or controlling the behaviour, I have one suggestion, below.

    Adjust Versioning Settings in SharePoint

    OneDrive for Business uses SharePoint as the backend for file storage, and versioning is handled by SharePoint document libraries. You can control how many versions are kept per file:

    • Go to SharePoint Online Admin Center.
    • Navigate to the document library that OneDrive syncs to (for example, Documents).
    • Click on the Library Settings gear in the upper right corner and select Library Settings.
    • Under the Versioning Settings option, you can configure how many versions to keep.
    • Choose Keep drafts for one version only or set a limit on the number of major versions to retain.
    • You can also configure to keep only 2 versions instead of the default 500, which will significantly reduce space usage.

    So the only possibilities in your case are :

    1. Versioning Settings in SharePoint/OneDrive: You should adjust versioning settings in SharePoint or OneDrive to control how many versions of each file are kept. For example, you can set it to retain only the last X versions or just the major versions. This is where you can limit and clean up file versions.
    2. Automating Version Cleanup: If you want a more automated approach to deleting older versions, you'll need to rely on PowerShell scripts or Power Automate flows, as the SharePoint or OneDrive UI does not provide a bulk deletion feature for versions.
    0 comments No comments