【问题标题】:Dowload zip file from blob with SAS link using azcopy使用 azcopy 从带有 SAS 链接的 blob 下载 zip 文件
【发布时间】:2020-04-06 10:27:27
【问题描述】:
我尝试使用 powershell 中的 SAS 链接从 blob 下载 zip 文件。我使用here 中提到的确切语法,但出现以下错误
failed to perform copy command due to error: cannot use directory as source without --recursive or a trailing wildcard (/*)
下面是脚本
.\azcopy.exe copy '<SAS link to file>' '<local file path>'
我使用 AzCopy 版本 10.3.3
【问题讨论】:
标签:
azure
powershell
azure-blob-storage
azcopy
【解决方案1】:
您的 linking article 包含适用于 Azure 文件 的示例命令。但是,您提到要从问题中的 blob 下载 zip 文件。
当使用 blob 存储但我的 Azure 文件中的文件路径时,我可以重现此问题。请确保您的命令中没有任何拼写错误,尤其是 blob 存储 URL 和文件存储 URL。
如果您想从 blob 存储下载文件,请参考this。
语法
azcopy copy 'https://<storage-account-name>.<blob or dfs>.core.windows.net/<container-name>/<blob-path>?<SAS-token>' '<local-file-path>'
示例
azcopy copy 'https://mystorageaccount.blob.core.windows.net/mycontainer/myTextFile.txt?<SAS-token>' 'C:\myDirectory\myTextFile.txt'
示例(分层命名空间)
azcopy copy 'https://mystorageaccount.dfs.core.windows.net/mycontainer/myTextFile.txt?<SAS-token>' 'C:\myDirectory\myTextFile.txt'