gsutil / gcloud storage file listing sorted date descending?

前端 未结 2 675
遇见更好的自我
遇见更好的自我 2021-02-18 13:41

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

相关标签:
2条回答
  • 2021-02-18 14:18

    I use this as a workaround:

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

    This outputs full listing including date as the second field, sort -k 2 then sorts by this field.

    0 讨论(0)
  • 2021-02-18 14:18

    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.

    0 讨论(0)
提交回复
热议问题