4
public void CopyBlobsBetweenContainers(string sourceContainerName, string targetContainerName, IEnumerable<string> blobsToCopy)
{
foreach (var sourceBlobName in blobsToCopy)
{
_cancellationToken.ThrowIfCancellationRequested();
var sourceBlob = sourceContainer.GetPageBlobReference(sourceBlobName);
if (!sourceBlob.Exists())
{
throw new InvalidOperationException(SafeFormatter.Format(CloudLocalization.Culture, CloudLocalization.CannotCopyBlobDoesNotExist, sourceBlobName));
}
var targetBlob = targetContainer.GetPageBlobReference(sourceBlobName);
if (targetBlob.Exists())
{
throw new InvalidOperationException(SafeFormatter.Format(CloudLocalization.Culture, CloudLocalization.CannotCopyTargetAlreadyExists, sourceBlobName));
}
_logger.Debug("Copying blob '{0}' from container '{1}' to '{2}'", sourceBlobName, sourceContainerName, targetContainerName);
targetBlob.Create(sourceBlob.Properties.Length);
targetBlob.StartCopy(sourceBlob);
}
_logger.Debug("Copy blobs finished");
}
소스 컨테이너의 폴더 (CloudBlobDirectory)에 내 페이지 모양이있는 경우 폴더를 복사하고 싶지 않습니다. 대상 컨테이너에 내 페이지 방울을 복사하고 싶습니다. 이 작업을 수행하는 방법?컨테이너간에 얼룩을 복사하는 방법은 무엇입니까?
메모는 AzCopy 명령 줄 유틸리티의 기초가되는 라이브러리 인 Microsoft Azure 저장소 데이터 이동 라이브러리에 있습니다. 자세한 내용은 https://www.nuget.org/packages/Microsoft.Azure.Storage.DataMovement/ 및 https://github.com/Azure/azure-storage-net-data-movement를 참조하십시오. –
데이터 이동 라이브러리가 Azure SDK에 포함되어 있습니까? 나는 그것이 독립 실행 형 일이라고 생각했다 ... – BenV
@BenV 올바른, 그것은 독립 실행 형 라이브러리입니다. 내 대답을 업데이트했습니다. – yonisha