google-cloud-platformgoogle-cloud-storagelsgsutil

gsutil to list all files in a bucket that have been deleted


How do you list all objects in a bucket that have been deleted when object versioning has been enabled? I'd like to use gsutil for this if possible.

Edit: It seems like there is no built in tool to do this. Could there perhaps be a way to do it via some combination of gsutil and another bash tool?

When you have a large amount of files, listing all versions is too much information and obscures what one might be looking for: do I have any deleted files and should I permanently delete them or restore them.


Solution

  • Since November 2023 (GCloud 454.0.0), gcloud storage ls gs://path --soft-deleted shows the soft-deleted blobs.

    The fully deleted blobs are gone, as is their metadata.