remove ErrorAction from recursive delete
This commit is contained in:
@@ -35,6 +35,6 @@ Write-Output "Deleting all files more than ${OlderThan} day(s) old ${SysTemp}"
|
|||||||
Foreach ( $item in (Get-ChildItem -Path "${SysTemp}") )
|
Foreach ( $item in (Get-ChildItem -Path "${SysTemp}") )
|
||||||
{
|
{
|
||||||
## If it's older than the number of days specified, recursively delete the directory
|
## 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 }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user