|
Re: How to delete "old" directories (recursively)? Get-ChildItem -Recurse -Path .\* |
where{ ($_.mode -match '^d.*') -and
(([datetime]::Today-$_.CreationTime.Date).Days -gt X) } |
%{ Remove-Item $_ }
It's all one line.
Replace X for real value of days and .\* for real path. |