Code example (7):
for blob in bucket.list_blobs(delimiter='/', prefix='subdir/'):
if blob.name = 'subdir/':
print("should not happen")
else:
# real blob, proceed
Maybe I am not getting it, but after looking into the API and the issues I thought that above should not happen should not be printed when using delimiter and prefix. Is this the intended behavior, so that I must filter out the subdir itself in the loop to only operate on real blobs?
@frankyn FYI
HI @james-woods,
Looking for clarification. I'm assuming you're seeing "should not happen" as it found a blob with subdir/?
If this is correct, it's possible that you created a "folder" using the Cloud Storage browser. When a folder is created an empty object with the folder name is created to "simulate" a file structure even though a file structure doesn't really exist.
Hi @frankyn - yes. I think you've nailed it. My question would be how I can remove the artificial folder with the minimum amount of steps as the "folder" keeps holds over 90k objects.
gsutil rm gs://bucket/subdir/ did the trick :)
Most helpful comment
HI @james-woods,
Looking for clarification. I'm assuming you're seeing "should not happen" as it found a blob with
subdir/?If this is correct, it's possible that you created a "folder" using the Cloud Storage browser. When a folder is created an empty object with the folder name is created to "simulate" a file structure even though a file structure doesn't really exist.