I have been trying to copy data from blobs in multiple batches referring the below code in powershell.
$MaxReturn = 10000
$ContainerName = "abc"
$Total = 0
$Token=New-Object -TypeName 'Microsoft.WindowsAzure.Storage.Blob.BlobContinuationToken'
$Token.NextMarker='last stored token value'
do
{
$Blobs = Get-AzureStorageBlob -Container $ContainerName -MaxCount $MaxReturn -ContinuationToken $Token
$Total += $Blobs.Count
if($Blobs.Length -le 0) { Break;}
$Token = $Blobs[$blobs.Count -1].ContinuationToken;
}
While ($Token -ne $Null)
Echo "Total $Total blobs in container $ContainerName"
I am saving the value of $Token after each batch in a file.I want to restart copying data from the continuation token which was last saved in the file.
To achieve this, i am manually replacing the line $Token=null with $Token="last saved token" and it throws me an error
"Cannot bind parameter 'ContinuationToken'. Cannot convert the value of type "System.String" to type "Microsoft.WindowsAzure.Storage.Blob.BlobContinuationToken".
How can i pass the value of last saved token to ContinuationToken parameter of Get-AzureStorageBlob ?
I have tried using
$Token=New-Object -TypeName Microsoft.WindowsAzure.Storage.Blob.BlobContinuationToken -NextMarker "Token value"
but it again throws an error
Cannot find type [Microsoft.WindowsAzure.Storage.Blob.BlobContinuationToken]: verify that the assembly containing this type is loaded.
Below is the powershell command to check for the same.
PS C:\Users\F\Documents> [Microsoft.WindowsAzure.Storage.Blob.BlobContinuationToken]
