Skip to content

Instantly share code, notes, and snippets.

@1RedOne
Created March 22, 2016 01:53
Show Gist options
  • Save 1RedOne/0d9e341c210dc01ae40c to your computer and use it in GitHub Desktop.
Save 1RedOne/0d9e341c210dc01ae40c to your computer and use it in GitHub Desktop.
#oh man, everyone elses were so much better, this is embarassing...
#v3
$folder = 0
$pgnFiles = 'X:\ChessData-master\ChessData-master'
$blacktot=$whitetot=$null
$blacktot = new-object System.Collections.ArrayList
$whitetot = new-object System.Collections.ArrayList
$draw = new-object System.Collections.ArrayList
#-Activity "Processing $file" -PercentComplete (($i/$files.Count) * 100) -Status ("$i out of " + $files.Count +" completed "+[math]::Round((($i/$files.Count) * 100),2) +" %")
gci $pgnfiles | ForEach-object {
$folder++
"processing $folder of 10"
#setting up base number
#write-progress -activity "Ham" -status "Sorting $($folder.Name)" -percentcomplete $(($folder/10)*100) -currentOperation OuterLoop
$i=0
$files = gci $("$($_.FullName)\*.pgn")
ForEach ($file in $files){
#increment
#$i++
#Write-Progress -Activity "Processing $file" -id 1 -PercentComplete (($i/$files.Count) * 100) -Status ("$i out of " + $files.Count +" completed "+[math]::Round((($i/$files.Count) * 100),2) +" %") -currentOperation InnerLoop
Get-content $file.FullName |Select-String "Result" | % {
$black = $_.ToString().Substring(9,3)[0]
$white = $_.ToString().Substring(9,3)[2]
if ($black -eq $white){[void]$draw.Add('') ; return}
else {if ($black -gt $white){
[void]$blacktot.Add('')
}
else{
[void]$whitetot.Add('')
}
}
}
#End of File
}
#endofFolder
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment