SharePoint storage

Free up SharePoint storage by finding and removing inactive files

Learn how to effectively identify, review, and remove inactive files from your SharePoint environment to reduce clutter and SharePoint storage costs.
Scott Ortlepp
Updated
October 6, 2025
4 min to read

TLDR

Inactive files contribute to increased SharePoint storage expenses and create unnecessary clutter within sites, impeding effective collaboration and potentially spreading outdated information throughout the organization. This reduced content freshness also negatively affects the performance of Copilot.

Proactively removing inactive files, either through deletion or archiving, will enhance tenant health and help minimise storage costs.

What is an inactive file?

Files are considered to be inactive when they have not been modified for an extended period of time, for example: 1, 2, or 3 years. It is worth noting that, in some cases, even when a document is inactive for an extended period of time, it may still be relevant to the business (possibly for regulatory or reference purposes). Due to this, cleanup of inactive files should be approached carefully and in consultation with content owners.

Why are inactive files an issue?

Inactive files are problematic for several reasons, particularly in workspaces where collaboration is important. Here are a few of the areas where inactive files can cause issues:

  1. Storage costs – Inactive files increase storage expenses without any benefit; removing them reduces costs.
  2. Information overload – They clutter libraries, making the latest relevant information harder to find and searches less effective.
  3. Old/outdated information – These files can spread outdated or incorrect details within the business.
  4. Copilot readiness – Inactive files are less likely to be relevant to current operational activities, and having them clutter the references and reasoning of Copilot is counter-productive.

What are the options to fix this issue?

Deleting

Inactive files that are not needed for legitimate business purposes anymore can be deleted to free up storage and reduce clutter.

Archiving

In situations where most or all files in a SharePoint site are inactive, archiving the entire site may be the easiest and most time and cost-effective approach. For more information about archiving, see How to reduce SharePoint storage costs by archiving sites.

*Note: Microsoft plans to support file-level archiving within Microsoft 365 Archive in the near future.

How to find and remove inactive files – use the SharePoint UI

Finding inactive files in a SharePoint library

To find inactive files in a SharePoint library, you can simply order the library view by Modified – Older to newer.

*Note: you can also create a view that ignores folders, but you may run into list view threshold issues, as discussed in our article Why large lists cause issues in SharePoint.

Finding inactive files using SharePoint search

To find inactive files via SharePoint search, simply use the following KQL (Keyword Query Language) query:

LastModifiedTime<2024-12-01

*Note: the date format used is YYYY-MM-DD

Removing inactive files from a SharePoint library

To remove the files from the library view, you can simply select the file or files and select Delete.

Advantages

  • Always available – Users are able to perform these actions at any time.
  • No admin privileges required – Any user with the correct owner or member access will be able to perform these actions.

Disadvantages

  • Recycle bin – Items deleted using this method still go through the recycle bin process and until that process is completed, they still count towards the storage quota for your site.
  • Manual – This is a time intensive, manual action that multiple users need to perform within sites they have access to.
  • Bulk actions – Bulk actions are limited to what you can select, including deleting a folder and all files inside that folder.

How to find and remove inactive files – use PowerShell

Find inactive files with PowerShell

To find inactive files in PowerShell, you need to connect to the desired site and query the library where you believe there may be inactive files with the following:

Get-PnPListItem -List "<Library Name>" | Where-Object { $_["Modified"] -lt <Inactive Date>}

This will return all files in the library that have a modified date before your given date.

*Note: In this example, we get the $Date variable with the following:

$Date = (Get-Date).AddYears(-1)

To get a CSV report of all inactive files, download the PowerShell script: Report on InactiveFiles.ps1

Remove inactive files with PowerShell

To remove inactive files use the following command:

Remove-PnPFile -ServerRelativeUrl <Server Relative URL> -Recycle:$false -Force

Caution: This will remove the inactive file permanently without first sending it to the recycle bin, and will not prompt for confirmation.

To remove inactive files in bulk, you can either remove all files modified before a certain date or remove files from within the CSV report.

Remove Inactive files modified before a date

$InactiveFiles = Get-PnPListItem-List "<Library Name>" | Where-Object {$_["Modified"] -lt  <Inactive Date>}

ForEach($InactiveFile in $InactiveFiles)

{

Remove-PnPFile -ServerRelativeUrl $InactiveFile.FieldValues.FileRef -Recycle:$false -Force

}

*Note: this method is not recommended as this does not allow you to review the files before deletion.

Remove inactive files in CSV report

Once the CSV report generated in Report on Inactive Files.ps1 has been reviewed by the relevant users, you can download and run the following PowerShell script: Remove Inactive Files.ps1

Advantages

  • Recycle bin – This process will skip the recycle bin and immediately free up storage capacity.
  • Time saving – By enabling bulk actions, you can reduce the amount of time needed to process.

Disadvantages

  • Admin intensive – This requires an admin with knowledge of PowerShell to generate the report and delete the required files.
  • Limited scope – Each library will need to be reported on individually and reviewed by the relevant users before the deletion script can be run.
  • User interface – CSV files are not user friendly and require conversion to and from .XLSX format if you want to add formatting to the reports for your users.

How to find and remove inactive files – use SProbot

Finding inactive files in SProbot

To find inactive files in SProbot, you can either navigate to a specific site you'd like to clean up, or if you don't know which sites contain inactive files you can use the Workspaces with most inactive files review.

This will give you a list of sites with the most inactive files (or the highest percentage of inactive files).

Screenshot of the SProbot "Sites with many inactive files" review displaying sites with a high percentage of inactive files

Opening a specific site's Content tab displays the number of files last modified more than 1 year ago (you can also view the large file report).

Screenshot of the Content tab inside a site, showing the number of inactive files with the ability to run a detailed report

Running a detailed report gives you a full list of all inactive files matching the threshold (1, 2 or 3 years) and then enables you to:

  • Search within the results set
  • Filter according to last modified date, editor, extension and minimum size
  • Export the results to CSV

Removing inactive files in SProbot

Using SProbot, you can either remove files in bulk or individually.

Simply select the file(s) you want to delete and use Cleanup > Delete.

Advantages of using SProbot

  • Automatic identification - The system automatically counts inactive files and highlights sites with the highest counts so that you do not need to run reports on hundreds of individual sites.
  • User friendly – The report interface is user friendly and easy to understand.
  • Time saving – Being able to perform the actions in bulk reduces the time needed to remove inactive files.
  • Space saved – SProbot lets you know how much space each cleanup action will save.
Need to reduce SharePoint storage costs?
Use SProbot to find and deal with redundant, obsolete and trivial content on your tenant
Need help with your SharePoint project?
We have helped organisations optimise their use of SharePoint since 2003
Get useful SharePoint and Teams insights first

See how SProbot can help you cut operational costs

We'll show you how to save on storage, tame content sprawl, and improve security.

Get a demo