Posts

Showing posts from January, 2023

Delete all the previous year files from the Site collection using PowerShell

Image
 Sometimes it is possible that, when you are working with millions of files in your SharePoint site’s and you just don’t require the previous year files stored inside various document libraries and want to remove all the files from document libraries, then it is very time-consuming process when it comes to delete millions of files manually from different document libraries of the site collection. In this article, we will focus on how to remove all the previous year files present in any document library in the site collection using PowerShell. It is possible that PowerShell may take time to complete the execution of the script if the site contains large number of files inside its document libraries. We need to follow the below steps to create the script for the deletion of the previous year files.                       1.    First, we need to add the “dll” files in our GAC folder and add the path in our script. Add-Type -Path "C:\Program Files\Common Files\microsof