我正在尝试使用AzCopy for Linux从我的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/'.
我已经在互联网上寻找解决方案,没有运气我最终在这里问了一个问题。
答案 0 :(得分:1)
虽然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"
展望未来,我将使用符合Linux标准且简单易用的Cool Azure CLI。
答案 1 :(得分:1)
我们可以使用此脚本上传带有Azcopy(Linux)的单个文件:
azcopy \
--source /mnt/myfiles \
--destination https://myaccount.file.core.windows.net/myfileshare/ \
--dest-key <key> \
--include abc.txt
使用--include
指定要上传的文件,例如,请检查一下:
root@jasonubuntu:/jason# pwd
/jason
root@jasonubuntu:/jason# ls
test1
root@jasonubuntu:/jason# azcopy --source /jason/ --destination https://jasondisk3.blob.core.windows.net/jasonvm/ --dest-key m+kQwLuQZiI3LMoMTyAI8K40gkOD+ZaT9HUL3AgVr2KpOUdqTD/AG2j+TPHBpttq5hXRmTaQ== --recursive --include test1
Finished 1 of total 1 file(s).
[2017/11/20 07:45:57] Transfer summary:
-----------------
Total files transferred: 1
Transfer successfully: 1
Transfer skipped: 0
Transfer failed: 0
Elapsed time: 00.00:00:02
root@jasonubuntu:/jason#
有关Linux上Azcopy的更多信息,请参阅此link。