From bad0d240278eb29dd31573eb873182165311dfb4 Mon Sep 17 00:00:00 2001 From: David Yoder Date: Thu, 18 Aug 2022 18:59:01 -0400 Subject: [PATCH] fix array building --- Remove-OldRevitLocals.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Remove-OldRevitLocals.ps1 b/Remove-OldRevitLocals.ps1 index 33cc56b..dd5a056 100644 --- a/Remove-OldRevitLocals.ps1 +++ b/Remove-OldRevitLocals.ps1 @@ -1,11 +1,13 @@ + # Set the maximum allowed age of Revit local files $FileAllowedAge = (Get-Date).AddMonths(-1) # Build all Revit local paths $RevitLocalPaths = @() ForEach ( $userProfile in (Get-ChildItem -Path "${Env:SystemDrive}\Users" | Where-Object { $_.PSIsContainer }) ) { - If ( Test-Path "${userProfile}\Documents\Revit Locals" ) { LogMsg "Adding search path: ""${userProfile}""" ; $RevitLocalPaths.Add("${userProfile}\Documents\Revit Locals") } - If ( Test-Path "${userProfile}\Documents" ) { LogMsg "Adding search path: ""${userProfile}""" ; $RevitLocalPaths.Add("${userProfile}\Documents") } + $profilePath = $userProfile.FullName + If ( Test-Path "${profilePath}\Documents\Revit Locals" ) { $RevitLocalPaths += ,@("${profilePath}\Documents\Revit Locals") } + If ( Test-Path "${profilePath}\Documents" ) { $RevitLocalPaths += ,@("${profilePath}\Documents") } } ForEach ( $path in $RevitLocalPaths ) {