gsutil / gcloud storage file listing sorted date descending?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



gsutil / gcloud storage file listing sorted date descending?



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.


gsutil ls


-t



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




2 Answers
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.





I'm guessing this is by design? To allow infinitely long directories / buckets?
– Dhiraj Gupta
Mar 2 at 5:54





I've been looking for official documentation of this feature (lexicographic object list ordering) and have been unable to find it. Are there any links that you know of?
– rdlowrey
Mar 22 at 19:01






The ordering must be deterministic since they allow paging of results, it's just not necessarily alphabetic (or controllable?). I'd love to see some official documentation on this as well as I haven't yet been able to find it.
– Sebastien Martin
Jun 28 at 19:08



I use this as a workaround:




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



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






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard