How To Delete Files Older Than X Days On Windows
We have already shown you how flexible the Linux shell can be, but that’s not to say Windows is any further behind. Here’s two techniques you can use depending on your shell preference, cmd or PowerShell. PowerShell 3 PowerShell 2 Explanation Firstly we get FileInfo and DirectoryInfo objects in the Path C:\Backups. FileInfo and DirectoryInfo objects both contain a CreationTime property, so we can filter the collection using that. The –lt (less than) operator is then used to compare the CreationTime property of the objects with Get-Date (the current date) subtract 5 days....