使用AzCopy将blob容器从一个存储帐户复制到另一个存储帐户时遇到问题。
尝试启动该过程时,出现此错误错误:
知道我为什么要遇到这个问题吗?
unknown command "/Source:https://pslfilestore.blob.core.windows.net/downloads" for "azcopy"
Run 'azcopy --help' for usage.
System.IO.StreamWriterdownloads
unknown command "/Source:https://pslfilestore.blob.core.windows.net/downloads" for "azcopy
"
请参见下面的代码
foreach (CloudBlobContainer items in containers)
{
var AzCopyProcess = new Process();
AzCopyProcess.StartInfo.UseShellExecute = false;
AzCopyProcess.StartInfo.RedirectStandardOutput = true;
AzCopyProcess.StartInfo.FileName = strCommand;
//pass storage account name, container and the key
AzCopyProcess.StartInfo.Arguments = $"/Source:https://{storageAccountName}.blob.core.windows.net/{items.Name} /Dest:{dayBlob.Uri}/{storageAccountName}/{items.Name} /SourceKey:{accountKey.ToString()} /DestKey:{pslFileStoreBackUpKey.ToString()} /S";
AzCopyProcess.Start();
StreamWriter stdOut = new StreamWriter(Console.OpenStandardOutput());
stdOut.AutoFlush = true;
Console.Write(stdOut);
var output = AzCopyProcess.StandardOutput.ReadToEnd();
Console.WriteLine($"{items.Name} {output}");
}
答案 0 :(得分:1)
从错误报告中,您正在使用AzCopy V10,但是代码为V8格式。我认为这是问题所在。
在V10中,副本使用情况应为:azcopy copy [source] [destination] [flags]
。
复制容器的语法应为:azcopy cp "https://<source-storage-account-name>.blob.core.windows.net/<container-name>" "https://<destination-storage-account-name>.blob.core.windows.net/<container-name>" --recursive
。
有关更多详细信息,请参考以下文档:Transfer data with AzCopy and Blob storage。或者,您可以像azure cp --help
这样使用来获取详细信息。