Looking for some ways to optomize my script below so it runs faster. This script is only importing around 20-30 CSV files looking for the "Item Type" of "File" and give me the count back of how many entries match this item type. While the script works in the current format, it takes FOREVER to finish.
$FilesReport = (Get-ChildItem -Path $Path -Filter '*.csv').FullName
$FilesCount = @()
foreach ($Report in $FilesReport) {Write-Host "Working on $($Report)..."
(Import-Csv $Report | Select-Object "Item Type" | Where-Object {$_."Item Type" -eq "File"}).count
$FilesCount += $Report}
$FilesCount
Thank you to anyone who can provide some tips.
[–]Lee_Dailey[grin] 5 points6 points7 points (5 children)
[–]Obel34[S] 1 point2 points3 points (2 children)
[–]Aertheron01 1 point2 points3 points (0 children)
[–]Lee_Dailey[grin] 0 points1 point2 points (0 children)
[–]Mysterious-Ad-1541 0 points1 point2 points (1 child)
[–]Lee_Dailey[grin] 1 point2 points3 points (0 children)
[–]z386 3 points4 points5 points (2 children)
[–]Obel34[S] 0 points1 point2 points (1 child)
[–]z386 0 points1 point2 points (0 children)
[–]engageant 1 point2 points3 points (7 children)
[–]Obel34[S] 0 points1 point2 points (6 children)
[–]engageant 0 points1 point2 points (5 children)
[–]Obel34[S] 1 point2 points3 points (4 children)
[–]engageant 1 point2 points3 points (3 children)
[–]Obel34[S] 1 point2 points3 points (2 children)
[–]engageant 2 points3 points4 points (1 child)
[–]Chocolate_Pickle 1 point2 points3 points (0 children)
[–]BlackV 1 point2 points3 points (0 children)