Delete files older than N days by using PowerShell on Windows 10
Author: Kevin   Posted: 26 June 2020   Viewed: 894 times   Tag: #Windows 10
Delete files older than N days automatically using PowerShell
1. Open Start
2. Search for Windows PowerShell and Run as administrator option
3. E.g Type the following command to delete files that haven’t been modified in the last 30 days and press Enter:
Get-ChildItem –Path "C:path ofolder" -Recurse | Where-Object {($_.LastWriteTime -lt (Get-Date).AddDays(-30))} | Remove-Item
(Note: remember to change "C:path ofolder" specifying the path to the folder that you want to delete files)
Related Items
Your Kind Action
You can express your appreciation and support to the Author by clicking on a Google advertisement in this website.
Got question? Contact us at info@ts-wiki.com