<分区>
我尝试在 gsutil
中使用 stat
命令,如下所示:
$ gsutil -q stat gs://test
但它导致了以下异常:
CommandException: The stat command only works with object URLs
注意:我不想使用ls
命令,因为桶里的文件太多了。
那么,我该怎么做呢?
<分区>
我尝试在 gsutil
中使用 stat
命令,如下所示:
$ gsutil -q stat gs://test
但它导致了以下异常:
CommandException: The stat command only works with object URLs
注意:我不想使用ls
命令,因为桶里的文件太多了。
那么,我该怎么做呢?
最佳答案
stat
仅提供 objects 的详细信息,而不是存储桶及其文件总数。
所以,最好的办法是使用 du
结合wc
:
$ gsutil du gs://your-bucket | wc -l
如果您在 Windows 上运行,请选中 this option或 this one对于 wc
命令。
关于google-cloud-storage - 如何计算桶中对象的数量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51423514/
相关文章:
google-cloud-storage - Google Cloud DNS CNAME 别名到 Google Cloud Storage
windows - gsutil rsync 排除模式不适用于 Windows Powershell
kubernetes - 在 GKE 中使用独立的 'gsutil'
php - 无法使用 Google API 将提供的 key 参数强制转换为私钥
Python - 从 Google Cloud Storage 下载整个目录
google-cloud-storage - 使用 api 更改存储桶中所有对象的 ACL