1: 2: 3: 4:
$DeleteDate = -5 $Path = "c:\test\*.txt" , "c:\test 2\*.txt" $xDays = (Get-Date).addDays($DeleteDate) Get-ChildItem $Path | where {$_.lastWriteTime -le $xDays} | Remove-Item -force