0

我正在尝试使用 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/'.

我已经在互联网上挖掘以寻找解决方案,但没有运气,我最终在这里问了一个问题。

4

2 回答 2

3

尽管 AzCopy 在 Linux 上遇到问题,但我可以使用 Azure CLI 无缝执行上述操作。Azure 文档中列出的以下代码帮助我做到了:

#!/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。

于 2017-11-20T07:20:13.397 回答
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 的更多信息,请参阅此链接

于 2017-11-20T07:49:48.237 回答