Kirill Cherepanov
Kirill Cherepanov

Reputation: 977

Override content type when uploading files to GCS with gsutil

I have a large number of files that I need to upload to Google Cloud Storage and add content type to them. All file names don't have an extension, but content type is the same for all of them.

I tried to use this command gsutil -m cp -r . gs://bucket_name/, but it uploads files with application/octet-stream content type.

Is there a way to override default content type that GCS sets?

Upvotes: 6

Views: 4156

Answers (1)

Mike Schwartz
Mike Schwartz

Reputation: 12145

Here, it gives an example of how to do this:

gsutil -h "Content-Type:text/html" \
       -h "Cache-Control:public, max-age=3600" cp -r images \
       gs://bucket/images

Upvotes: 13

Related Questions