Riaz
Riaz

Reputation: 69

gsutil stat bucket issue while Uploading

I tried to use the gsutil stat command to display object status for a subdirectory and got an error gsutil -q stat gs://my-bucket/my-object/

Upvotes: 0

Views: 115

Answers (1)

Priyashree Bhadra
Priyashree Bhadra

Reputation: 3597

Cloud Storage uses a flat namespace to store objects in buckets. While you can use slashes ("/") in object names to make it appear as if objects are in a hierarchical structure, the gsutil stat command treats a trailing slash as part of the object name.

For example, if you run the command gsutil -q stat gs://my-bucket/my-object/, gsutil looks up information about the object my-object/ (with a trailing slash), as opposed to operating on objects nested under my-bucket/my-object/. Unless you actually have an object with that name, the operation fails.

For subdirectory listing, use the gsutil ls instead.

Upvotes: 2

Related Questions