How do you make many files public in Google Cloud Storage?

前端 未结 6 546
独厮守ぢ
独厮守ぢ 2020-12-12 14:31

I have 1000 files in Google Cloud Storage to make public, or in general a directory hierarchy.

In the Web UI, I can only seem to make one at a time public.

I

6条回答
  •  情书的邮戳
    2020-12-12 15:34

    Run gsutil -m acl set -R -a public-read gs://bucket

    • The -m issues multiple requests at the same time.
    • The -R issues requests for every object in your bucket.
    • The -a issues requests for every version of every object.

    See gsutil help acl for more info.

    At the API layer gsutil issues the following HTTP request:

    PUT /bucket/obj?acl HTTP/1.1
    Host: storage.googleapis.com
    x-goog-acl: public-read
    

    You can see this by using the -D flag with gsutil:

    gsutil -D setacl public-read gs://bucket/obj
    

提交回复
热议问题