GCP: I tried to use the gsutil stat command to display object status for a subdirectory and got an error.

0 votes
Oct 25 in GCP by Karan
• 6,670 points
47 views

1 answer to this question.

0 votes

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.

answered Oct 25 by Sirajul
• 41,000 points

Related Questions In GCP

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to copy an object to a folder in the bucket?

Use the gsutil cp command to create a folder ...READ MORE

answered Oct 23 in GCP by Sirajul
• 41,000 points
14 views
0 votes
1 answer

GCP Error: 403: Access Denied

Check that your credentials are correct. For ...READ MORE

answered Oct 9 in GCP by Sirajul
• 41,000 points
36 views
0 votes
1 answer

Permissions issue with Google Cloud Storage Bucket.

You can regain access to the object by assigning an applicable role, like roles/storage.objectAdmin, to ...READ MORE

answered Oct 10 in GCP by Sirajul
• 41,000 points
112 views
0 votes
1 answer