Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gsutil zip directory on google cloud storage

is it possible to compress file or directory of google cloud storage without download it first and re-upload?

I think I need some tools similar like http://googlegenomics.readthedocs.org/en/latest/use_cases/compress_or_decompress_many_files/

thank you.

like image 616
oon arfiandwi Avatar asked Dec 14 '22 09:12

oon arfiandwi


2 Answers

No. There is no way to ask GCS to directly compress or decompress objects entirely within GCS. You can certainly copy them elsewhere in the cloud (GCE, for instance) and operate on them there, or you could download an uncompressed object as a compressed object simply by using the Accept-Encoding: gzip header, but, again, not without taking it out of GCS in some fashion.

like image 71
Brandon Yarbrough Avatar answered Jan 18 '23 18:01

Brandon Yarbrough


From

https://console.cloud.google.com/storage/browser/your-bucket

open a cloud shell (top right of the page), then:

gsutil cp -r gs://your-bucket .
zip your-bucket.zip ./your-bucket
gsutil cp your-bucket.zip gs://your-bucket

Strictly it is not happening in place within your storage but within the cloud.

like image 25
Harps Avatar answered Jan 18 '23 19:01

Harps