I am currently looking for a way to set permission as public for all files in folder of gcloud bucket.
I need to set the permission individually.
Already refer google document(https://cloud.google.com/storage/docs/access-control/making-data-public) but only find one by one changes. (I cannot use object apply way)
Is there any way to change permission as public for all files in files of gcloud bucket?
In order to change all files from a bucket folder to public you can run:
gsutil acl -r ch -u AllUsers:R gs://[BUCKET_NAME]/[FOLDER_NAME]/*
Note that the -r
flag would also make public all files inside subfolders in the original folders (i.e, gs://[BUCKET_NAME]/[FOLDER_NAME]/[FOLDER_2]/FILE would also be public). Take it out if you don't want that effect.
You can also use the -m
flag to run the operation i.n parallel by adding it between gsutil
and acl
(i.e, gsutil -m acl
)
This method relies on the use of wildcards ( * ), you can also use them to "filter" files
There are other operations (I just listed the basics) in the documentation.