Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set metadata for all objects in a Google Storage bucket

I want to set Content-Type metadata to image/jpeg for all objects of a Google Storage bucket.

How to do this?

like image 944
porton Avatar asked Oct 07 '18 18:10

porton


1 Answers

Using gsutil and its setmeta command:

gsutil -m setmeta -h "Content-Type:image/jpeg" gs://YOUR_BUCKET/**/*.jpg

Use the -m to activate a parallel update, in case you have a lot of objects.

The /**/* pattern will perform a recursive search on any folders that you may have on your bucket.

like image 127
Mangu Avatar answered Jan 02 '23 20:01

Mangu