diff --git a/Cleanup-SystemTempFiles.ps1 b/Cleanup-SystemTempFiles.ps1 index d0c0e05..c5c3fdd 100644 --- a/Cleanup-SystemTempFiles.ps1 +++ b/Cleanup-SystemTempFiles.ps1 @@ -35,6 +35,6 @@ Write-Output "Deleting all files more than ${OlderThan} day(s) old ${SysTemp}" Foreach ( $item in (Get-ChildItem -Path "${SysTemp}") ) { ## If it's older than the number of days specified, recursively delete the directory - If ( $item.LastWriteTime -lt ((Get-Date) - $timedelta) ) { Remove-Item $item.FullName -Recurse -ErrorAction SilentlyContinue -Force -ErrorAction SilentlyContinue } + If ( $item.LastWriteTime -lt ((Get-Date) - $timedelta) ) { Remove-Item $item.FullName -Recurse -ErrorAction SilentlyContinue -Force } }