This script removes all files from the current folder (in this case 'c:\temp') that are not accessed during the last 3 months. A confirmation is asked because -Confirm is included.
Get-ChildItem -Recurse | where { $_.LastAccessTime -lt (Get-Date).AddMonths(-3) } | Remove-Item -Recurse -Force -Confirm
Nenhum comentário:
Postar um comentário