我尝试使用适用于 Linux 的 AzCopy 从 Ubuntu 计算机将示例文件上传到 Azure,但无论我更改为什么权限/所有权,我都会不断收到以下错误。
$ azcopy --source ../my_pub --destination https://account-name.blob.core.windows.net/mycontainer --dest-key account-key
Incomplete operation with same command line detected at the journal directory "/home/jmis/Microsoft/Azure/AzCopy", do you want to resume the operation? Choose Yes to resume, choose No to overwrite the journal to start a new operation. (Yes/No) Yes
[2017/11/18 22:06:24][ERROR] Error parsing source location "../my_pub": Failed to enumerate directory /home/jmis/my_pub/ with file pattern *. Cannot find the path '/home/jmis/my_pub/'.
我在互联网上挖掘寻找解决方案,但不幸的是我最终在这里提出了一个问题。
最佳答案
尽管 AzCopy 在 Linux 上遇到问题,但我可以使用 Azure CLI 无缝地执行上述操作。以下代码列于 Azure docs帮我做到了:
#!/bin/bash
# A simple Azure Storage example script
export AZURE_STORAGE_ACCOUNT=<storage_account_name>
export AZURE_STORAGE_ACCESS_KEY=<storage_account_key>
export container_name=<container_name>
export blob_name=<blob_name>
export file_to_upload=<file_to_upload>
export destination_file=<destination_file>
echo "Creating the container..."
az storage container create --name $container_name
echo "Uploading the file..."
az storage blob upload --container-name $container_name --file $file_to_upload --name $blob_name
echo "Listing the blobs..."
az storage blob list --container-name $container_name --output table
echo "Downloading the file..."
az storage blob download --container-name $container_name --name $blob_name --file $destination_file --output table
echo "Done"
今后我将使用 Cool Azure CLI,它兼容 Linux,而且也很简单。
关于linux - 适用于 Linux 的 AzCopy 上传文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47374186/