From df7f635e26ba0c39b7f49dbce81eb59ce278d2b3 Mon Sep 17 00:00:00 2001 From: David Yoder Date: Thu, 5 Oct 2023 13:19:25 -0400 Subject: [PATCH] remove alias in favor of cmdlet name --- Remove-OldFiles.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Remove-OldFiles.ps1 b/Remove-OldFiles.ps1 index a4e07b6..4ccb9c5 100644 --- a/Remove-OldFiles.ps1 +++ b/Remove-OldFiles.ps1 @@ -4,7 +4,7 @@ If ( $OlderThanDays -is [int] ) { If ( Test-Path $Path ) { Write-Output "Deleting all items older than ${OlderThanDays} days in ""${Path}""" - $files = Get-ChildItem $Path | Where { !$_.PSIsContainer -and $_.LastWriteTime -lt (Get-Date).AddDays(-${OlderThanDays}) } + $files = Get-ChildItem $Path | Where-Object { !$_.PSIsContainer -and $_.LastWriteTime -lt (Get-Date).AddDays(-${OlderThanDays}) } Foreach ( $f in $files ) { $msg = "Deleting {0}" -f $f.FullName ; Write-Output $msg Try { Remove-Item $f -Force | Out-Null }