8 lines
232 B
PowerShell
8 lines
232 B
PowerShell
|
|
$ls = Get-Item $env:TEMP\*.tmp # or your path and file extension
|
||
|
|
$date = (Get-Date).AddDays(-14)
|
||
|
|
foreach ($l in $ls) {
|
||
|
|
if ($l.LastWriteTime -le $date) {
|
||
|
|
$l.FullName
|
||
|
|
Remove-Item $l.FullName -Recurse
|
||
|
|
}
|
||
|
|
}
|