Google cloud storage 如何使用gsutil仅公开我的*.jpg和*.png图像?

Google cloud storage 如何使用gsutil仅公开我的*.jpg和*.png图像?,google-cloud-storage,Google Cloud Storage,我有一个包含许多子目录的bucket,其中包含各种不同的文件。我如何才能使我的图像公开访问?下面的内容非常适合将所有内容公开,但我似乎无法对扩展进行过滤 $ gsutil -m acl set -R -a public-read gs://mybucket gsutil接受 所以这很好: $ gsutil -m acl set -R -a public-read gs://mybucket/**/*.jpg $ gsutil -m acl set -R -a public-read gs://

我有一个包含许多子目录的bucket,其中包含各种不同的文件。我如何才能使我的图像公开访问?下面的内容非常适合将所有内容公开,但我似乎无法对扩展进行过滤

$ gsutil -m acl set -R -a public-read gs://mybucket
gsutil接受

所以这很好:

$ gsutil -m acl set -R -a public-read gs://mybucket/**/*.jpg
$ gsutil -m acl set -R -a public-read gs://mybucket/**/*.png

我建议使用
gsutil acl ch
,这将保留对象上的所有现有acl,并使它们公开可读。此命令应起到以下作用:

gsutil -m acl ch -u AllUsers:R gs://mybucket/**/*.png gs://mybucket/**/*.jpg

使用固定acl(即,
acl集-公共读取
)可以删除您所做的其他acl更改。

请注意,使用**通配符时不需要-R选项。您只需执行以下操作:gsutil-m acl set-a public read gs://mybucket/***.png gs://mybucket/***.jpg