gsutil / gcloud storage file listing sorted date descending?

我的梦境 提交于 2019-12-23 07:07:07

问题


Is there no way to get a file listing out from a Google Cloud Storage bucket that is sorted by date descending? This is very frustrating. I need to check the status of files that are uploaded and the bucket has thousands of objects.

gsutil ls does not have the standard linux -t option.

Google cloud console also lists it but does not offer sorting options.


回答1:


I use this as a workaround:

gsutil ls -l gs://[bucket-name]/ | sort -k 2




回答2:


The only ordering supported by GCS is lexicographic.

As a workaround, if it's possible for you to name your objects with a datestamp, that would give you a way to list objects by date.



来源:https://stackoverflow.com/questions/49045725/gsutil-gcloud-storage-file-listing-sorted-date-descending

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!