我想知道如何使用aws s3api list-objects-v2显示日期和大小
使用下面的命令:
aws s3api list-objects-v2 --bucket mybucket --prefix Videos --query "Contents[?StorageClass=='STANDARD_IA'].Key" --output text | sed 's/\t/\n/g'
Ouutput:
Videos/test2/test2.mxf
Videos/mov2.mp4
My desired output:
1/18/2018 1.0 GiB Videos/test2/test2.mxf
1/18/2017 3.0 GiB Videos/mov2.mp4谢谢
发布于 2018-01-18 19:12:36
AWS Command-Line Interface (CLI)不会以这种格式提供输出,但是您可以获取CLI输出,并根据需要对其进行格式化。
最灵活的方法是接收JSON输出,然后在脚本(如bash或python)中重新格式化。
正常的aws s3 ls命令给出的输出几乎与您想要的输出相同,但是不允许使用您使用的query参数。
https://stackoverflow.com/questions/48318963
复制相似问题