3 ms·
In PowerShell: ls /dir -re | ? LastWriteTime -lt (Get-Date).AddDays(-7) | del i.e. 1: enumerate the files recursively (ls is alias for Get-ChildItem) 2:
by useerup 11y ago
In PowerShell:
ls /dir -re | ? LastWriteTime -lt (Get-Date).AddDays(-7) | del
i.e.
1: enumerate the files recursively (ls is alias for Get-ChildItem)
2: pipe through a filter (? is alias for Where-Object) that selects only files written to more than 7 days ago
3: pipe those files to the Remove-Item command (del is alias for Remove-Item)