Created
April 7, 2015 08:14
-
-
Save pkirch/0f338126ac0e3e9376aa 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
# Get all BLOBs from source container and start copy operation asynchronously for all files based on $fileFilter. | |
Get-AzureStorageBlob -Context $sourceStorageContext -Container $sourceStorageContainer -Blob $fileFilter | | |
Start-AzureStorageBlobCopy -DestContext $destinationStorageContext -DestContainer $destinationStorageContainer | |
# Check copy state in destination container. | |
$waitTime = 5 # Initial wait time. | |
do { | |
# Wait some time before refresh of copy state, except on first iteration. | |
if ($copyState) { | |
Write-Host "Refresh in $waitTime seconds." | |
# After each iteration wait some more time. | |
Start-Sleep -Seconds ($waitTime++) | |
} | |
# Get all BLOBs in destination container and get copy state for all of them. | |
$copyState = Get-AzureStorageBlob -Context $destinationStorageContext -Container $destinationStorageContainer -Blob $fileFilter | | |
Get-AzureStorageBlobCopyState | |
# Print formatted output. | |
$copyState | Format-Table -Property CopyId, Status, TotalBytes, BytesCopied, @{Name = "Progress"; Expression = {$_.BytesCopied / $_.TotalBytes * 100}; FormatString = "0.00" }, CompletionTime -AutoSize | |
} while ($copyState.Status -contains "Pending") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment