Created
December 11, 2014 16:27
-
-
Save DamianStanger/7db6027600cd17d452e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$context = New-AzureStorageContext -StorageAccountName foobar -StorageAccountKey gsdfgdsfGSDFGsdFGSdfgSDFGSDFGsdfg | |
$imeis = Select-String -Path .\foo.txt -Pattern "." | ForEach-Object {$_.Line} | |
$dateResultMap = @{} | |
#echo "xxx70" | |
$MAXSIZE = 150 | |
for($i=0; $i -lt $imeis.Count; $i++){ | |
Write-Host -NoNewline "-" | |
} | |
write-host "" | |
foreach($imei in $imeis){ | |
$geoBlobs = Get-AzureStorageBlob -Container $imei -Context $context | Where-Object{$_.Name -like '*geo*' } | |
Write-Host -NoNewline "." | |
foreach($blob in $geoBlobs){ | |
$name = $blob.Name.Substring(0,10) | |
#echo "xxx75" | |
#echo $name | |
#echo "xxx80" | |
$existingdate = $null | |
if(!$dateResultMap.ContainsKey($name)){ | |
#echo "not found" | |
$existingdate = @{fail=0; success=0} | |
$dateResultMap.Add($name, $existingdate) | |
} else { | |
#echo "found" | |
$existingdate = $dateResultMap.get_item($name) | |
} | |
#echo "xxx85" | |
#echo $existingdate.fail $existingdate.success | |
if($blob.Length -lt $MAXSIZE){ | |
$existingdate.fail = $existingdate.fail + 1 | |
}else{ | |
$existingdate.success = $existingdate.success + 1 | |
} | |
#echo "xxx89" | |
#echo $existingdate.fail $existingdate.success | |
#echo "xxx90" | |
$name = $null | |
} | |
} | |
echo "xxx100" | |
$ordered = $dateResultMap.GetEnumerator() | Sort-Object Name | |
echo "xxx250" | |
foreach($key in $ordered){ | |
Write-Host $key.Name $key.Value.fail $key.Value.success #$ordered.Get_item($key).Values | |
} | |
echo "xxx200" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment