Azure azcopy Linux – 如何将变量传递给azcopy

huangapple go评论54阅读模式
英文:

AZure azcopy Linux - how to pass variable to azcopy

问题

好的,以下是代码部分的翻译:

$mm=04 ; start=`echo "开始日期: $(date)"` ; azcopy cp "https://reco.blob.core.windows.net/raw-voi-2022/2022-$mm/*?sv=2020-0RgUNH8A%3D" "https://storage.blob.core.windows.net/bin-voi-2022/2022-$mm?sv=2021-0HGICxvaLULI%3D"

结果:

作业 24fa36ea-8bda-cc4f-632a-07db4d922036 已启动
日志文件位于: /log/azcopy/24fa36ea-8bda-cc4f-632a-07db4d922036.log

100.0 %, 0 已完成, 0 失败, 0 待处理, 0 跳过, 0 总计,

                                                                                                                                                                                          作业 24fa36ea-8bda-cc4f-632a-07db4d922036 概要                                                                                                                                          经过时间(分钟): 0.0333
文件传输次数: 0
文件夹属性传输次数: 0
符号链接传输次数: 0
总传输次数: 0
已完成的文件传输次数: 0
已完成的文件夹传输次数: 0
失败的文件传输次数: 0
失败的文件夹传输次数: 0
跳过的文件传输次数: 0
跳过的文件夹传输次数: 0
已传输的总字节数: 0
最终作业状态: 完成

谢谢。

英文:

Good day

I want to pass the value of $mm to this azcopy. However, since azcopy parameters are in double quotes, it does not want to process correctly.

 $mm=04 ; start=`echo "START DATE: $(date)"` ; azcopy cp "https://reco.blob.core.windows.net/raw-voi-2022/2022-$mm/*?sv=2020-0RgUNH8A%3D" "https://storage.blob.core.windows.net/bin-voi-2022/2022-$mm?sv=2021-0HGICxvaLULI%3D"

Results:

Job 24fa36ea-8bda-cc4f-632a-07db4d922036 has started
Log file is located at: /log/azcopy/24fa36ea-8bda-cc4f-632a-07db4d922036.log

100.0 %, 0 Done, 0 Failed, 0 Pending, 0 Skipped, 0 Total,

                                                                                                                                                                                          Job 24fa36ea-8bda-cc4f-632a-07db4d922036 summary                                                                                                                                          Elapsed Time (Minutes): 0.0333
Number of File Transfers: 0
Number of Folder Property Transfers: 0
Number of Symlink Transfers: 0
Total Number of Transfers: 0
Number of File Transfers Completed: 0
Number of Folder Transfers Completed: 0
Number of File Transfers Failed: 0
Number of Folder Transfers Failed: 0
Number of File Transfers Skipped: 0
Number of Folder Transfers Skipped: 0
TotalBytesTransferred: 0
Final Job Status: Completed

Thank you.

答案1

得分: 1

我已总结我们的讨论,并将上述评论发布为答案。

由于您正在Linux中运行上述cmdlet命令,您需要使用mm=04来初始化变量,而不是使用$mm=04

英文:

I have summarized our discussion and posting the above comment as an answer.

Since you are running the above cmdlet in Linux, you need to initialize the variable with as mm=04 instead of using $mm=04

答案2

得分: 0

在Linux操作系统中,不要使用$来声明变量。

# mm=10 ; start=`echo "START DATE: $(date)"` ; azcopy --overwrite=false cp "https://reco.blob.core.windows.net/raw-scr-2022/2022-$mm/*?sv=2021-11gLGKAJj3mMT8%3D" "https://storage.blob.core.windows.net/bin-scr-2022/2022-$mm?sv=2021-10sDQ%3D" ; end=`echo "END DATE: $(date)"`;  echo $start ; echo $end
INFO: Scanning...
INFO: Failed to create one or more destination container(s). Your transfers may still succeed if the container already exists.
INFO: Any empty folders will not be processed, because source and/or destination doesn't have full folder support

Job 5b0aa50e-d718-0142-72da-7be5962e3a5f has started
Log file is located at: /log/azcopy/5b0aa50e-d718-0142-72da-7be5962e3a5f.log

49.2 %, 60467 Done, 656 Failed, 58877 Pending, 0 Skipped, 120000 Total (scanning...), 2-sec Throughput (Mb/s): 57442.6611 (Service may be limiting speed)
英文:

When you are in a Linux os, don't use $ to declare a variable.

# mm=10 ; start=`echo "START DATE: $(date)"` ; azcopy --overwrite=false cp "https://reco.blob.core.windows.net/raw-scr-2022/2022-$mm/*?sv=2021-11gLGKAJj3mMT8%3D" "https://storage.blob.core.windows.net/bin-scr-2022/2022-$mm?sv=2021-10sDQ%3D" ; end=`echo "END DATE: $(date)"`;  echo $start ; echo $end
INFO: Scanning...
INFO: Failed to create one or more destination container(s). Your transfers may still succeed if the container already exists.
INFO: Any empty folders will not be processed, because source and/or destination doesn't have full folder support

Job 5b0aa50e-d718-0142-72da-7be5962e3a5f has started
Log file is located at: /log/azcopy/5b0aa50e-d718-0142-72da-7be5962e3a5f.log

49.2 %, 60467 Done, 656 Failed, 58877 Pending, 0 Skipped, 120000 Total (scanning...), 2-sec Throughput (Mb/s): 57442.6611 (Service may be limiting speed)

huangapple
  • 本文由 发表于 2023年7月3日 14:14:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/76602233.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定