Skip to content

Instantly share code, notes, and snippets.

@Curtmcgirt
Last active September 24, 2019 00:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Curtmcgirt/2af417b7eb6301a0c6b6ef323f0709d1 to your computer and use it in GitHub Desktop.
Save Curtmcgirt/2af417b7eb6301a0c6b6ef323f0709d1 to your computer and use it in GitHub Desktop.
posh v2
#v2
Measure-Command {foreach($source in $sources)
{
$count = 0
foreach($allstat in $allstats)
{
$sourcepath = $source.path.replace('\','/')
if($allstat.sourcefilename -like "*$sourcepath*")
{
$count++
}
}
$array += [pscustomobject]@{count = $count; path = $source.path}
}}
#v3
measure-command {foreach($source in $sources)
{
$sourcepath = $source.path.replace('\','/')
$count = ($allstats | ? sourcefilename -like "*$sourcepath*").count
$array += [pscustomobject]@{count = $count; path = $source.path}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment