Hi all. Is there a way to create sub-buckets using...
# google-cloud
Hi all. Is there a way to create sub-buckets using storage.Bucket()? I cannot find any examples of how it’s done. Thx!
That might sound stupid… is there anything like sub-buckets in GCS? I’ve never heard of it.
Unless… you meant “how to a create empty folder within GCS bucket”. If so, you can achieve that e.g. by explicitly creating an object with trailing slash in name:
Copy code
field is required but it will be ignored in case object has trailing slash in name. Just a reminder, GCS (and basically most of object storage solutions) uses a flat filesystem. That means, you don’t have to actually create empty folders in order to store things within them. You can directly upload file
and it will “create” parent directories automatically (cause in fact, it’s just a long name with slashes and not a real tree-like structure).
🙌 1
I believe when you create a folder from the web console it sets a specific mime type to identify it as a folder marker. You need that if you want to
gsutil rsync
somewhere including the empty folder if I'm not mistaken
makes sense. Thanks a lot for the pointers