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
|
||||
ForEach ( $item in $items ) {
|
||||
If ( $item.LastWriteTime -lt $TimeDelta ) {
|
||||
Try {
|
||||
Remove-Item -Path $item.FullName -Force -ErrorAction Continue
|
||||
$itemFullName = $item.FullName
|
||||
Write-Output "DELETING: ${itemFullName}"
|
||||
}
|
||||
Try { Remove-Item -Path $item.FullName -Force -ErrorAction Continue }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user