You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure CLI中JMESPath数值比较报错:int与str无法比较

Azure CLI筛选非空Blob时类型错误的解决方法

问题根源

命令中的JMESPath查询条件[?properties.contentLength > '0'].name里,'0'被定义为字符串类型,而properties.contentLength返回的是整数类型,整数与字符串无法通过>运算符直接比较,因此触发类型错误。

正确命令

去掉0的单引号,让比较两边均为整数类型即可解决:

az storage blob list --account-name myaccount --account-key myaccountkey --container-name mycontainer --prefix myprefix --query "[?properties.contentLength > 0].name" --num-results "*" --output tsv|more

说明

修正后的命令会筛选指定容器、指定前缀路径下所有内容长度大于0的Blob(自动排除空Blob和目录),并以TSV格式输出Blob名称。

内容的提问来源于stack exchange,提问作者Sourcerer

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 03:47:17