Link to home
Start Free TrialLog in
Avatar of RayT
RayTFlag for United States of America

asked on

Arrays & Loops in PowerShell

How do I modify the following script to use Arrays and Loops?

I would like the search folders to be in an array.  Then I can just loop through the array.

$compareDate = (Get-Date).AddDays(-14)
$temp = Get-ChildItem "c:\vbapps\ASP.NET_Apps\" -Recurse| Where-Object { $_.LastWriteTime -ge $compareDate } | Select FullName
$result = $temp
$temp = Get-ChildItem "c:\vbapps\WinForms_Apps\" -Recurse| Where-Object { $_.LastWriteTime -ge $compareDate } | Select FullName
$result = $temp + $result
$result
SOLUTION
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RayT

ASKER

Thanks!  That's what I needed.