I have a site that has files created before 7 years(before 2015). I need to delete all of them by applying filters (Filename has the file created date on it Example:20130204.PDF). Could anyone please provide the powershell script for deleting these files.

1 Answer 1


Depending on the number of sites, libraries and files you have it might not be the best approach to use powershell.

Unless this is a one-off house cleaning, it might be best to enable the retention policy of your SharePoint libraries to delete content older (create before) 7 years.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.