cleanup recycle bin cleaner
This commit is contained in:
@@ -68,11 +68,7 @@ If ( ($UserRecycleBins | Measure-Object).Count -gt 0 ) {
|
|||||||
$items = Get-ChildItem -Path $userRecycleBin.FullName -Recurse -ErrorAction SilentlyContinue
|
$items = Get-ChildItem -Path $userRecycleBin.FullName -Recurse -ErrorAction SilentlyContinue
|
||||||
ForEach ( $item in $items ) {
|
ForEach ( $item in $items ) {
|
||||||
If ( $item.LastWriteTime -lt $TimeDelta ) {
|
If ( $item.LastWriteTime -lt $TimeDelta ) {
|
||||||
Try {
|
Try { Remove-Item -Path $item.FullName -Force -ErrorAction Continue }
|
||||||
Remove-Item -Path $item.FullName -Force -ErrorAction Continue
|
|
||||||
$itemFullName = $item.FullName
|
|
||||||
Write-Output "DELETING: ${itemFullName}"
|
|
||||||
}
|
|
||||||
Catch { Write-Error $_.Exception.Message }
|
Catch { Write-Error $_.Exception.Message }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user