繁体   English   中英

需要使用 shell 脚本从 azure 中的 blob 存储中获取文件名

[英]Need to get the filename from a blob storage in azure using shell script

我试图在 blob 存储中获取文件名,以便在我的脚本中进一步使用它。 我尝试使用 az storage blob list 并列出那里存在的 blob,但没有成功。

这是我使用的命令:

az storage blob list --connection-string connstr --container-name "vinny/input/"

它抛出错误,因为请求的 URI 不代表服务器上的任何资源。ErrorCode: InvalidUri

似乎它只会占用容器而不是其中的文件夹。 但是当我尝试时:

az storage blob list --connection-string connstr --container-name "vinny"

它没有列出文件,而是继续执行。

我需要获取 vinny/input/ 中的文件名

任何人有任何解决方案吗?

我刚刚添加了一个 --prefix 选项,并且能够按照我想要的方式列出文件。 它是这样的:

az storage blob list --connection-string connstr --container-name "vinny" --prefix "Input/" --output table
cli> az storage blob list -c container_name  --account-name storage_accaunt_name --output=table --num-results=* | awk or cut 

然后你可以用awk和cut等解析txt文件。

祝你好运

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM